From b11aaefd9d5ad1a455dfaf472b2cc4f1cfdeaeed Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 29 Oct 2025 01:45:33 -0500 Subject: maybe it doesn't suck anymore. code might work. --- complete.go | 16 +++++++--------- 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 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 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 diff --git a/parse.go b/parse.go index bdeec1d..824603f 100644 --- a/parse.go +++ b/parse.go @@ -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...) } -- cgit v1.2.3