From b749c60b288c90b3712e8bd0990099aee7edd7bf Mon Sep 17 00:00:00 2001 From: Alexandru Claudius Virtopeanu Date: Wed, 22 Nov 2023 17:28:27 +0200 Subject: [PATCH] fix: inverse condition persist flag vals --- comptplus.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/comptplus.go b/comptplus.go index 521ced9..b68d684 100644 --- a/comptplus.go +++ b/comptplus.go @@ -14,9 +14,6 @@ import ( // DynamicSuggestionsAnnotation for dynamic suggestions. const DynamicSuggestionsAnnotation = "cobra-prompt-dynamic-suggestions" -// PersistFlagValuesFlag the flag that will be available when PersistFlagValues is true -const PersistFlagValuesFlag = "persist-flag-values" - const CacheIntervalFlag = "cache-interval" // CobraPrompt given a Cobra command it will make every flag and sub commands available as suggestions. @@ -136,7 +133,7 @@ func (co *CobraPrompt) executeCommand(ctx context.Context) func(string) { os.Exit(1) } } - if co.PersistFlagValues { + if !co.PersistFlagValues { executedCmd, _, _ := co.RootCmd.Find(os.Args[1:]) co.resetFlagsToDefault(executedCmd) }