diff options
Diffstat (limited to 'argv.go')
| -rw-r--r-- | argv.go | 74 |
1 files changed, 38 insertions, 36 deletions
@@ -9,33 +9,45 @@ package main */ import ( - "fmt" "os" "go.wit.com/lib/debugger" "go.wit.com/lib/gui/logsettings" + "go.wit.com/lib/gui/prep" "go.wit.com/log" ) var argv args type args struct { - TestBuild *EmptyCmd `arg:"subcommand:build" help:"try appropriate 'go build'"` - DebBuild *EmptyCmd `arg:"subcommand:debian" help:"build missing .deb packages"` - MacBuild *EmptyCmd `arg:"subcommand:macos" help:"build macos packages"` - MakeInstall *EmptyCmd `arg:"subcommand:install" help:"run make install in each repo"` - ListPkgs *EmptyCmd `arg:"subcommand:list" help:"list all the packages on mirrors.wit.com"` - Test *EmptyCmd `arg:"subcommand:test" help:"test build everything first"` - Clone *EmptyCmd `arg:"subcommand:repomap-clone" help:"go-clone from a gowebd repomap"` - Upgrade *EmptyCmd `arg:"subcommand:upgrade" help:"apt upgrade packages installed from mirrors.wit.com"` - RepoMap string `arg:"--repomap" help:"location of the repomap"` - Release bool `arg:"--release" help:"use go-deb --release"` - DryRun bool `arg:"--dry-run" help:"only show what would be packaged"` - Verbose bool `arg:"--verbose" help:"be loud about it"` - Force bool `arg:"--force" help:"rebuild everything"` - Recursive bool `arg:"--recursive" help:"go-clone --recursive"` - WITCOM bool `arg:"--witcom" help:"add the GPL header"` - Max int32 `arg:"--max" help:"stop building after max builds"` + TestBuild *DefaultCmd `arg:"subcommand:build" help:"try appropriate 'go build'"` + DebBuild *DebianCmd `arg:"subcommand:debian" help:"build missing .deb packages"` + MacBuild *EmptyCmd `arg:"subcommand:macos" help:"build macos packages"` + MakeInstall *DefaultCmd `arg:"subcommand:install" help:"run make install in each repo"` + ListPkgs *EmptyCmd `arg:"subcommand:list" help:"list all the packages on mirrors.wit.com"` + Test *EmptyCmd `arg:"subcommand:test" help:"test build everything first"` + Clone *EmptyCmd `arg:"subcommand:repomap-clone" help:"go-clone from a gowebd repomap"` + Upgrade *EmptyCmd `arg:"subcommand:upgrade" help:"apt upgrade packages installed from mirrors.wit.com"` + RepoMap string `arg:"--repomap" help:"location of the repomap"` + Release bool `arg:"--release" help:"use go-deb --release"` + DryRun bool `arg:"--dry-run" help:"only show what would be packaged"` + Verbose bool `arg:"--verbose" help:"be loud about it"` + Force bool `arg:"--force" help:"rebuild everything"` + Recursive bool `arg:"--recursive" help:"go-clone --recursive"` + WITCOM bool `arg:"--witcom" help:"add the GPL header"` + Max int32 `arg:"--max" help:"stop building after max builds"` +} + +type DebianCmd struct { + DryRun bool `arg:"--dry-run" help:"only show what would be packaged"` + Verbose bool `arg:"--verbose" help:"be loud about it"` + Force bool `arg:"--force" help:"rebuild everything"` +} + +type DefaultCmd struct { + DryRun bool `arg:"--dry-run" help:"only show what would be packaged"` + Verbose bool `arg:"--verbose" help:"be loud about it"` + Force bool `arg:"--force" help:"rebuild everything"` } type EmptyCmd struct { @@ -68,25 +80,15 @@ func (args) Version() string { handles shell autocomplete */ -func (a args) DoAutoComplete(argv []string) { - switch argv[0] { - case "list": - fmt.Println("--all --mine --favorites --private") - case "debian": - fmt.Println("--dry-run --force --release --verbose macos --max") - case "upgrade": - fmt.Println("--dry-run") - case "build": - fmt.Println("--verbose --force") - case "install": - fmt.Println("--verbose") - case "repomap-clone": - fmt.Println("--repomap") - default: - if argv[0] == ARGNAME { - // list the subcommands here - fmt.Println("--bash list build debian install repomap-clone upgrade") - } +func (args) Appname() string { + return ARGNAME +} + +func (a args) DoAutoComplete(pb *prep.Auto) { + if pb.Cmd == "" { + pb.Autocomplete3([]string{"--bash", "build", "debian", "install", "macos"}) + } else { + pb.SubCommand(pb.Argv...) } os.Exit(0) } |
