package main import ( "fmt" "os" ) /* this parses the command line arguements this enables command line options from other packages like 'gui' and 'log' */ var argv args type args struct { Repo string `arg:"positional" help:"go import path"` AutoWork bool `arg:"--work" default:"false" help:"recreate the go.work file"` DryRun bool `arg:"--dry-run" help:"show what would be run"` Recursive bool `arg:"--recursive" default:"true" help:"recursively clone all dependencies"` Build bool `arg:"--build" help:"try to build it after clone"` Install bool `arg:"--install" help:"try to install it after clone"` Ignore bool `arg:"--ignore" default:"false" help:"ignore weird clone errors from non-standard repos"` // Fetch bool `arg:"--git-fetch" default:"false" help:"run 'git fetch' on all your repos"` } func (args) Version() string { return "go-clone " + VERSION + " Built on " + BUILDTIME } func (a args) Description() string { return ` git clone go repositories recursively Examples: go-clone go.wit.com/apps/go-clone # 'git clone' go-clone ` } func (a args) DoAutoComplete(argv []string) { switch argv[0] { case "checkout": fmt.Println("user devel master ") case "--recursive": fmt.Println("true false") default: if argv[0] == ARGNAME { // list the subcommands here fmt.Println("--dry-run --recursive --work") } } os.Exit(0) }