summaryrefslogtreecommitdiff
path: root/argv.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-25 02:24:17 -0500
committerJeff Carr <[email protected]>2025-09-25 02:24:17 -0500
commit21313117b70fe7aba836d4ffc57ae60b29bb695f (patch)
treeee49bd514c571b2c5fc375da91e0beb420484f6f /argv.go
parent673264006848cd0a6ab2323fc4d325197238a821 (diff)
new argv bash autocompletev0.0.106v0.0.105
Diffstat (limited to 'argv.go')
-rw-r--r--argv.go74
1 files changed, 38 insertions, 36 deletions
diff --git a/argv.go b/argv.go
index 1f3791c..d71e315 100644
--- a/argv.go
+++ b/argv.go
@@ -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)
}