diff options
Diffstat (limited to 'argv.go')
| -rw-r--r-- | argv.go | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -36,8 +36,6 @@ type args struct { BuildForge bool `arg:"--forge-rebuild" help:"download and rebuild forge"` 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 { @@ -148,6 +146,7 @@ forge -- a tool to manage lots of git repos. forge includes a GUI and TUI. ` } +/* func (args) doBashHelpDebug() { fmt.Fprintln(os.Stderr, "") fmt.Fprintln(os.Stderr, "hello world") @@ -164,6 +163,7 @@ func (args) doBashHelpDebug() { fmt.Fprintln(os.Stderr, "pull something else", argv.BashAuto, len(argv.BashAuto), p0, p1, p2, p1a, "end", more) fmt.Fprintln(os.Stderr, "") } +*/ /* handles shell autocomplete @@ -177,14 +177,15 @@ func deleteMatch() { fmt.Println("go.wit.com/lib/gui/repostatus todo: need to do this") } -func ifBlank() bool { - if argv.BashAuto[1] == "''" { +func ifBlank(arg string) bool { + if arg == "''" { // if empty, the user has not typed something return true } return false } +/* // prints help to STDERR // TODO: move everything below this to go-args func (args) doBashHelp() { if argv.BashAuto[1] != "''" { @@ -204,9 +205,20 @@ func (args) doBashHelp() { fmt.Fprintln(os.Stderr, "") } -func (args) doBashAuto() { - // argv.doBashHelp() - switch argv.BashAuto[0] { +func (a args) doBashAuto() { + DoAutoComplete(argv.BashAuto) + os.Exit(0) +} +*/ + +func (a args) DoAutoComplete(argv []string) { + DoAutoComplete(argv) +} + +func DoAutoComplete(argv []string) { + // fmt.Fprintln(os.Stderr, "") // these are for debugging + // fmt.Fprintln(os.Stderr, "in autocomplete:", argv) // these are for debugging + switch argv[0] { case "checkout": fmt.Println("devel master user") case "clean": @@ -224,7 +236,7 @@ func (args) doBashAuto() { case "dirty": fmt.Println("") case "gui": - if ifBlank() { + if ifBlank(argv[1]) { fmt.Fprintln(os.Stderr, "") fmt.Fprintln(os.Stderr, "CUI: terminal interface using 'gocui'") fmt.Fprintln(os.Stderr, "GUI: linux and macos GUI using GTK") @@ -250,7 +262,7 @@ func (args) doBashAuto() { case "verify": fmt.Println("user devel master") default: - if argv.BashAuto[0] == ARGNAME { + if argv[0] == ARGNAME { // list the subcommands here fmt.Println("help list checkout clean commit dirty debug fetch gui normal merge patch pull") } |
