From e629211edd82f3910cff3c3db2c272a48c01fa56 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 9 Sep 2025 08:41:15 -0500 Subject: make args work again --- argv.go | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'argv.go') diff --git a/argv.go b/argv.go index c25659e..1f3791c 100644 --- a/argv.go +++ b/argv.go @@ -9,6 +9,9 @@ package main */ import ( + "fmt" + "os" + "go.wit.com/lib/debugger" "go.wit.com/lib/gui/logsettings" "go.wit.com/log" @@ -22,6 +25,7 @@ type args struct { 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"` @@ -30,10 +34,8 @@ type args struct { Verbose bool `arg:"--verbose" help:"be loud about it"` Force bool `arg:"--force" help:"rebuild everything"` Recursive bool `arg:"--recursive" help:"go-clone --recursive"` - Test bool `arg:"--test" help:"test build after everything else"` WITCOM bool `arg:"--witcom" help:"add the GPL header"` - Bash bool `arg:"--bash" help:"generate bash completion"` - BashAuto []string `arg:"--auto-complete" help:"does the actual autocompletion"` + Max int32 `arg:"--max" help:"stop building after max builds"` } type EmptyCmd struct { @@ -61,3 +63,30 @@ func init() { func (args) Version() string { return "wit-test " + VERSION + " Built on " + BUILDTIME } + +/* + 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") + } + } + os.Exit(0) +} -- cgit v1.2.3