new autocomplete method

This commit is contained in:
Jeff Carr 2025-09-25 01:40:54 -05:00
parent dcac6d6608
commit 5f2f877001
3 changed files with 14 additions and 36 deletions

41
argv.go
View File

@ -1,9 +1,9 @@
package main package main
import ( import (
"fmt"
"os" "os"
"os/user"
"go.wit.com/lib/gui/prep"
) )
/* /*
@ -52,34 +52,15 @@ func (args) Version() string {
handles shell autocomplete handles shell autocomplete
*/ */
func (a args) DoAutoComplete(argv []string) { func (args) Appname() string {
switch argv[0] { return ARGNAME
case "checkout": }
usr, _ := user.Current()
fmt.Println("user devel master " + usr.Username) func (a args) DoAutoComplete(pb *prep.Auto) {
case "commit": if pb.Cmd == "" {
fmt.Println("--all") pb.Autocomplete3([]string{"--bash", "quick"})
case "config": } else {
fmt.Println("add fix list delete") pb.SubCommand(pb.Argv...)
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")
}
} }
os.Exit(0) os.Exit(0)
} }

View File

@ -7,7 +7,6 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/fhelp" "go.wit.com/lib/fhelp"
"go.wit.com/lib/gadgets" "go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/prep" "go.wit.com/lib/gui/prep"
@ -27,9 +26,8 @@ var argv args
func main() { func main() {
me = new(autoType) 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.myGui = prep.Gui() // prepares the GUI package for go-args
me.pp = arg.MustParse(&argv) me.auto = prep.Bash3(&argv) // this line should be: prep.Bash(&argv)
me.forge = forgepb.Init() me.forge = forgepb.Init()
me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes

View File

@ -2,7 +2,6 @@
package main package main
import ( import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui" "go.wit.com/gui"
"go.wit.com/lib/gadgets" "go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/prep" "go.wit.com/lib/gui/prep"
@ -13,7 +12,7 @@ import (
var me *autoType var me *autoType
type autoType struct { 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 myGui *prep.GuiPrep // the gui handle itself
releaseReasonS string // = "gocui dropdown select" releaseReasonS string // = "gocui dropdown select"
release releaseStruct // notsure release releaseStruct // notsure