From 5f2f877001dfa6d26f3a2ec30ff4852db124a7e3 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 25 Sep 2025 01:40:54 -0500 Subject: new autocomplete method --- argv.go | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) (limited to 'argv.go') diff --git a/argv.go b/argv.go index e6651a5..1c7c2e3 100644 --- a/argv.go +++ b/argv.go @@ -1,9 +1,9 @@ package main import ( - "fmt" "os" - "os/user" + + "go.wit.com/lib/gui/prep" ) /* @@ -52,34 +52,15 @@ func (args) Version() string { handles shell autocomplete */ -func (a args) DoAutoComplete(argv []string) { - switch argv[0] { - case "checkout": - usr, _ := user.Current() - fmt.Println("user devel master " + usr.Username) - case "commit": - fmt.Println("--all") - case "config": - fmt.Println("add fix list delete") - case "list": - fmt.Println("--all --mine --favorites --private") - case "pull": - fmt.Println("--all --mine --favorites --private") - case "patch": - fmt.Println("--list --submit --show") - case "dirty": - fmt.Println("--show-files") - case "user": - fmt.Println("--force") - case "devel": - fmt.Println("--force") - case "master": - fmt.Println("--force") - default: - if argv[0] == ARGNAME { - // list the subcommands here - fmt.Println("--bash quick") - } +func (args) Appname() string { + return ARGNAME +} + +func (a args) DoAutoComplete(pb *prep.Auto) { + if pb.Cmd == "" { + pb.Autocomplete3([]string{"--bash", "quick"}) + } else { + pb.SubCommand(pb.Argv...) } os.Exit(0) } -- cgit v1.2.3