start undocker

This commit is contained in:
2021-05-24 00:11:57 +03:00
commit 0f883d49e7
2 changed files with 54 additions and 0 deletions

39
main.go Normal file
View File

@@ -0,0 +1,39 @@
package main
import (
"fmt"
"os"
"errors"
goflags "github.com/jessevdk/go-flags"
)
type opts struct {
PositionalArgs struct {
Infile goflags.Filename `long:"infile" description:"Docker container tarball"`
Outfile string `long:"outfile" description:"Output tarball"`
} `positional-args:"yes" required:"yes"`
}
func main() {
if err := run(os.Args); err != nil {
os.Exit(1)
}
os.Exit(0)
}
func run(args []string) error {
var flags opts
args1, err := goflags.ParseArgs(&flags, args)
if err != nil {
return err
}
if len(args1) != 0 {
return errors.New("too many args")
}
fmt.Printf("infile: %s\n", flags.PositionalArgs.Infile)
fmt.Printf("outfile: %s\n", flags.PositionalArgs.Outfile)
return nil
}