diff options
| author | Jeff Carr <[email protected]> | 2025-10-29 01:45:33 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-29 01:45:33 -0500 | 
| commit | b11aaefd9d5ad1a455dfaf472b2cc4f1cfdeaeed (patch) | |
| tree | 63a97fc3d5168ffcf61c58ab96d503e6f2ca864d | |
| parent | 7a352b4c34d7662227f09a248079e387887157a3 (diff) | |
maybe it doesn't suck anymore. code might work.v1.6.7
| -rw-r--r-- | complete.go | 16 | ||||
| -rw-r--r-- | parse.go | 7 | 
2 files changed, 11 insertions, 12 deletions
diff --git a/complete.go b/complete.go index 0fb29c9..aba6a33 100644 --- a/complete.go +++ b/complete.go @@ -40,16 +40,14 @@ func ParseFlagsArgv(dest ...interface{}) (*Parser, error) {  		*/  		return p, err  	} -	if argvpb.PB.ErrCounter < 5 { -		if argvpb.Len() == 0 { -			// user didn't enter any text and is hitting <tab> after the command itself -			p.WriteHelp(argvpb.Stderr) -			if p.match != nil { -				// calls back to the application. this allows the application to provide autocomplete matches -				p.match() -			} -			return p, errors.New("WriteHelp() worked") +	if argvpb.Len() == 0 { +		// user didn't enter any text and is hitting <tab> after the command itself +		p.WriteHelp(argvpb.Stderr) +		if p.match != nil { +			// calls back to the application. this allows the application to provide autocomplete matches +			p.match()  		} +		return p, errors.New("WriteHelp() worked")  	}  	if argvpb.PB.GetCmd() == "" {  		// user is trying to get help for a subcommand @@ -100,9 +100,10 @@ func Register(dest ...interface{}) {  // MustParse processes command line arguments and exits upon failure  func MustParseArgv(dest ...interface{}) *Parser {  	register = append(register, dest...) -	if len(overrideFlags) == 0 { -		overrideFlags = append(overrideFlags, argvpb.Real()...) -	} +	// if len(overrideFlags) == 0 { +	// 	overrideFlags = append(overrideFlags, argvpb.Real()...) +	// } +	overrideFlags = argvpb.Real()  	return mustParse(Config{Exit: mustParseExit, Out: mustParseOut}, register...)  }  | 
