slowly working out autocomplete kinks

This commit is contained in:
Jeff Carr 2025-09-18 15:24:20 -05:00
parent 19479f312f
commit 4d4dcf31cb
3 changed files with 11 additions and 18 deletions

17
argv.go
View File

@ -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)
}

View File

@ -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

View File

@ -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