summaryrefslogtreecommitdiff
path: root/argv.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-09 02:30:38 -0500
committerJeff Carr <[email protected]>2025-09-09 02:33:08 -0500
commit4827be1d2ab4a37fc45a31116df2f109e1a8390e (patch)
treefc504474185f6acb277baa21c82c494f879b8d4d /argv.go
parentf1c1ca950c0a2868dc7feb6f86a0b48254d95a94 (diff)
cleaner argv autocomplete
Diffstat (limited to 'argv.go')
-rw-r--r--argv.go32
1 files changed, 3 insertions, 29 deletions
diff --git a/argv.go b/argv.go
index 500229e..a203c8e 100644
--- a/argv.go
+++ b/argv.go
@@ -25,8 +25,6 @@ type args struct {
Daemon bool `arg:"--daemon" help:"run as a daemon"`
Force bool `arg:"--force" help:"try to strong arm things"`
Verbose bool `arg:"--verbose" help:"show more output"`
- Bash bool `arg:"--bash" help:"generate bash completion"`
- BashAuto []string `arg:"--auto-complete" help:"todo: move this to go-arg"`
}
type EmptyCmd struct {
@@ -40,37 +38,13 @@ func init() {
arg.MustParse(&argv)
}
-// prints help to STDERR // TODO: move everything below this to go-args
-func (args) doBashHelp() {
- if len(argv.BashAuto) < 2 {
- fmt.Fprintf(os.Stderr, "something went wrong with the GO args autocomplete in %s\n", ARGNAME)
- return
- }
- if argv.BashAuto[1] != "''" {
- // if this is not blank, then the user has typed something
- return
- }
- if argv.BashAuto[0] != ARGNAME {
- fmt.Fprintln(os.Stderr, argv.BashAuto[0])
- // if this is not the name of the command, the user already started doing something
- return
- }
- if argv.BashAuto[0] == ARGNAME {
- me.pp.WriteHelp(os.Stderr)
- return
- }
- fmt.Fprintln(os.Stderr, "")
- fmt.Fprintln(os.Stderr, "something went wrong with the GO args package")
- fmt.Fprintln(os.Stderr, "")
-}
-
-func (args) doBashAuto() {
+func (a args) DoAutoComplete(argv []string) {
// argv.doBashHelp()
- switch argv.BashAuto[0] {
+ switch argv[0] {
case "merge":
fmt.Println("--force")
default:
- if argv.BashAuto[0] == ARGNAME {
+ if argv[0] == ARGNAME {
// list the subcommands here
fmt.Println("list merge")
}