Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While perusing found this subtle bug #176

Closed
wants to merge 1 commit into from
Closed

While perusing found this subtle bug #176

wants to merge 1 commit into from

Conversation

cyx
Copy link
Contributor

@cyx cyx commented Mar 19, 2021

We should be comparing the name as well.

We should be comparing the name as well.
@@ -366,7 +366,7 @@ func shouldPromptWhenFlagless(cmd *cobra.Command, flag string) bool {
isSet := false

cmd.LocalFlags().VisitAll(func(f *pflag.Flag) {
if f.Changed {
if f.Name == flag && f.Changed {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This visits all the flag and if any is set, it takes it in account for the return value. If we check for the name, aren't we only taking in account the status of that single flag?
Context: #130 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I see. Ok we can close this totally misunderstood the intent of this 👍

@cyx cyx closed this Mar 20, 2021
@cyx cyx deleted the prompt-bugfix branch March 20, 2021 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants