diff options
| author | Jeff Carr <[email protected]> | 2025-10-28 13:33:02 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-28 13:33:02 -0500 | 
| commit | 29e9ff750be077804284bd939deea29942379c8b (patch) | |
| tree | d0e1231f22524d3b31e53f81217fac35394b04da | |
| parent | b5240fccf2df4a6f2a4ee99847a9d5c3901fe4a5 (diff) | |
maybe working good enough to leave it alone for a while
| -rw-r--r-- | complete.go | 40 | 
1 files 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) {  | 
