Skip to content

Commit

Permalink
fix: inverse condition persist flag vals
Browse files Browse the repository at this point in the history
  • Loading branch information
avirtopeanu-ionos committed Nov 22, 2023
1 parent 93c05bd commit b749c60
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions comptplus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit b749c60

Please sign in to comment.