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) } diff --git a/main.go b/main.go index af89b57..547b988 100644 --- a/main.go +++ b/main.go @@ -7,7 +7,6 @@ import ( "os" "path/filepath" - "go.wit.com/dev/alexflint/arg" "go.wit.com/lib/fhelp" "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/prep" @@ -27,9 +26,8 @@ var argv args func main() { me = new(autoType) - prep.Bash(ARGNAME, argv.DoAutoComplete) // this line should be: prep.Bash(argv) - me.myGui = prep.Gui() // prepares the GUI package for go-args - me.pp = arg.MustParse(&argv) + me.myGui = prep.Gui() // prepares the GUI package for go-args + me.auto = prep.Bash3(&argv) // this line should be: prep.Bash(&argv) me.forge = forgepb.Init() me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes diff --git a/structs.go b/structs.go index 3c0bd2f..10f8e32 100644 --- a/structs.go +++ b/structs.go @@ -2,7 +2,6 @@ package main import ( - "go.wit.com/dev/alexflint/arg" "go.wit.com/gui" "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/prep" @@ -13,7 +12,7 @@ import ( var me *autoType type autoType struct { - pp *arg.Parser // for parsing the command line args. Yay to alexf lint! + auto *prep.Auto // more experiments for bash handling myGui *prep.GuiPrep // the gui handle itself releaseReasonS string // = "gocui dropdown select" release releaseStruct // notsure