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

View File

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

View File

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