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

Copy parsed flag values when constructing LocalFlags() #1020

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bcongdon
Copy link

This checks in the failing test that #1019 references, and proposes a fix to LocalFlags() not copying information about whether a flag has been parsed or not.

If preferable, I can open a PR against spf13/pflag to change flagSet.AddFlag to copy the fact that a flag already has a value instead of performing that logic here.

@CLAassistant
Copy link

CLAassistant commented Mar 6, 2020

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

github-actions bot commented May 6, 2020

This PR is being marked as stale due to a long period of inactivity

@bcongdon
Copy link
Author

bcongdon commented May 8, 2020

Pinging this, CLA is signed

// If `f` has already been changed, re-add its value to the flag set,
// otherwise `c.lflags` has no record of the flags value.
if f.Changed {
f.Changed = false
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is it that you need to unset the Changed field? I thought the point was to just copy over the new value, I didn't expect to see this modified as well.

@johnSchnake
Copy link
Collaborator

I'm so sorry its taken so long to respond to this PR. We are actively trying to tackle the backlog.

@johnSchnake johnSchnake self-assigned this Feb 21, 2022
@johnSchnake johnSchnake added area/flags-args Changes to functionality around command line flags and args area/lib Methods and functions that exist in the cobra library and consumed by users kind/bug A bug in cobra; unintended behavior and removed kind/stale labels Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/flags-args Changes to functionality around command line flags and args area/lib Methods and functions that exist in the cobra library and consumed by users kind/bug A bug in cobra; unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants