diff options
| author | Jeff Carr <[email protected]> | 2025-09-25 02:24:17 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-25 02:24:17 -0500 |
| commit | 21313117b70fe7aba836d4ffc57ae60b29bb695f (patch) | |
| tree | ee49bd514c571b2c5fc375da91e0beb420484f6f | |
| parent | 673264006848cd0a6ab2323fc4d325197238a821 (diff) | |
| -rw-r--r-- | argv.go | 74 | ||||
| -rw-r--r-- | main.go | 5 | ||||
| -rw-r--r-- | structs.go | 4 |
3 files changed, 41 insertions, 42 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) } @@ -10,7 +10,6 @@ import ( "path/filepath" "unicode" - "go.wit.com/dev/alexflint/arg" "go.wit.com/lib/gui/prep" "go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/gitpb" @@ -31,9 +30,7 @@ var debnames map[*gitpb.Repo]string func main() { me = new(autoType) - prep.Bash(ARGNAME, argv.DoAutoComplete) // todo: this line should be: prep.Bash(argv) - // me.myGui = prep.Gui() // prepares the GUI package for go-args - me.argpp = arg.MustParse(&argv) + me.auto = prep.Bash3(&argv) // add support for bash autocomplete with go-arg dumpDebug() @@ -4,7 +4,7 @@ package main import ( - "go.wit.com/dev/alexflint/arg" + "go.wit.com/lib/gui/prep" "go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/zoopb" ) @@ -13,7 +13,7 @@ var me *autoType // this app's variables type autoType struct { - argpp *arg.Parser // go-arg preprocessor + auto *prep.Auto // more experiments for bash handling forge *forgepb.Forge // your customized repo preferences and settings machine *zoopb.Machine // your customized repo preferences and settings } |
