From 29e9ff750be077804284bd939deea29942379c8b Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 28 Oct 2025 13:33:02 -0500 Subject: maybe working good enough to leave it alone for a while --- complete.go | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/complete.go b/complete.go index a1968bf..6189b1c 100644 --- a/complete.go +++ b/complete.go @@ -80,51 +80,33 @@ func (args) Examples() string { return out } -func (args) Match() bool { - if argvpb.PB.IsMatch("cache") { - matches, _ := matchCacheFiles() - fmt.Fprintf(argvpb.Stdout, "%s", matches) - return true - } - - if argvpb.PB.IsMatch("mode.--config") { - matches, _ := matchModeDirs() - fmt.Fprintf(argvpb.Stdout, "%s", matches) - return true - } - - if argvpb.PB.IsMatch("mode") { - matches := []string{"jwc", "false"} - fmt.Fprintf(argvpb.Stdout, "%s", " "+strings.Join(matches, " ")) - return true - } - return false -} - // sends the strings to bash or zsh that will be your options func (a args) DoAutoComplete() error { var err error me.pp, err = arg.ParseFlagsArgv(&argv) if err != nil { fmt.Fprintf(argvpb.Stddbg, "go-args parseFlagsArgv(%v) finished autocomplete\n", err) - // counter intuitive. return nil on err for now - return nil } + return err +} + +func (args) Match() bool { if argvpb.PB.IsMatch("cache") { matches, _ := matchCacheFiles() fmt.Fprintf(argvpb.Stdout, "%s", matches) - return nil + return true } + if argvpb.PB.IsMatch("mode.--config") { matches, _ := matchModeDirs() fmt.Fprintf(argvpb.Stdout, "%s", matches) - return nil + return true } + if argvpb.PB.IsMatch("mode") { - err = me.pp.WriteHelpForAutocomplete("", "mode") matches := []string{"jwc", "false"} fmt.Fprintf(argvpb.Stdout, "%s", " "+strings.Join(matches, " ")) - return nil + return true } if argvpb.PB.GetCmd() == "" { // these are base autocomplete strings @@ -132,9 +114,9 @@ func (a args) DoAutoComplete() error { matches = append(matches, "show", "add", "fixer", "dev", "verify", "mode", "gui", "whatchanged") matches = append(matches, "--version", "--force", "--all", "--verbose", "--help") fmt.Fprintf(argvpb.Stdout, "%s", strings.Join(matches, " ")) - return nil + return true } - return err + return false } func matchModeDirs() (string, error) { -- cgit v1.2.3