From 4d4dcf31cb466d441024978420f548346c088537 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 18 Sep 2025 15:24:20 -0500 Subject: [PATCH] slowly working out autocomplete kinks --- argv.go | 17 +++++------------ main.go | 9 +++++---- structs.go | 3 +-- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/argv.go b/argv.go index 35c3246..fcc5a91 100644 --- a/argv.go +++ b/argv.go @@ -164,7 +164,7 @@ func DoAutoComplete(autoArgv *prep.Auto) { if dur < time.Millisecond*200 { autoArgv.Debug = true autoArgv.Debugf("TODO: show extended help here '%s' '%s' %v dur=%v\n", autoArgv.Arg0, autoArgv.Arg1, autoArgv.Argv, shell.FormatDuration(dur)) - autoArgv.AutoDebug() + autoArgv.PrintDebug() fmt.Println(" ") } @@ -177,7 +177,7 @@ func DoAutoComplete(autoArgv *prep.Auto) { autoArgv.Debugf("user: checkout the user branches on all repos") } // argv.Checkout.Autocomplete("devel master user") - autoArgv.Autocomplete(argv.Checkout, "devel master user") + autoArgv.Autocomplete2("devel master user") case "clean": // me.pp.WriteHelp(os.Stderr) // me.pp.WriteUsageForSubcommand(os.Stderr, me.pp.SubcommandNames()...) @@ -185,14 +185,7 @@ func DoAutoComplete(autoArgv *prep.Auto) { // me.pp.WriteHelpForSubcommand(os.Stderr, "clean") fmt.Println("--force verify --repo") case "commit": - autoArgv.Debugf("WTF") - autoArgv.Autocomplete(argv.Commit, "--all") - if dur > time.Millisecond*200 { - if dur < time.Millisecond*800 { - // fmt.Println("a b") - fmt.Println("") - } - } + autoArgv.Autocomplete2("--all") case "config": fmt.Println("add fix list") case "dirty": @@ -210,7 +203,7 @@ func DoAutoComplete(autoArgv *prep.Auto) { case "list": fmt.Println("--mine --favorites --dirty") case "merge": - fmt.Println("devel master") + autoArgv.Autocomplete2("devel master --all") case "normal": fmt.Println("on off") case "pull": @@ -231,7 +224,7 @@ func DoAutoComplete(autoArgv *prep.Auto) { // if argv.ArgName == ARGNAME { // } // list the subcommands here - fmt.Println("help list checkout clean commit dirty fetch gui normal merge patch pull tag --gui") + autoArgv.Autocomplete2("help list checkout clean commit dirty fetch gui normal merge patch pull tag --gui") } os.Exit(0) } diff --git a/main.go b/main.go index d581730..8286376 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,6 @@ import ( "strings" "time" - "go.wit.com/dev/alexflint/arg" "go.wit.com/lib/gui/prep" "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/forgepb" @@ -44,9 +43,11 @@ func getVersion(repo *gitpb.Repo, name string) string { func main() { me = new(mainType) - me.auto = prep.Bash2(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) // these three lines are becoming terrible syntax + // prep.Bash2(ARGNAME, argv.DoAutoComplete) // this line should be: prep.Bash(&argv) + me.myGui = prep.Gui() // prepares the GUI package for go-args + me.auto = prep.Bash3(ARGNAME, argv.DoAutoComplete, &argv) // this line should be: prep.Bash(&argv) + // arg.MustParse(&argv) // these three lines are becoming terrible syntax + // me.auto = prep.MustParse(&argv) // try to make this work? me.forge = forgepb.Init() // init forge.pb me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes diff --git a/structs.go b/structs.go index 53edd9b..15b17bc 100644 --- a/structs.go +++ b/structs.go @@ -4,7 +4,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" @@ -28,7 +27,7 @@ func myServer() string { // this app's variables type mainType struct { - pp *arg.Parser // for parsing the command line args. Yay to alexflint! + // pp *arg.Parser // for parsing the command line args. Yay to alexflint! auto *prep.Auto // more experiments for bash handling forge *forgepb.Forge // for holding the forge protobuf files myGui *prep.GuiPrep // for initializing the GUI toolkits