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

StringSlice flags set to default Value #1131

Closed
wants to merge 4 commits into from

Conversation

darren-west
Copy link

StringSliceFlag types do not set the destination to the value if no env/arg is set.

For example if the argument --arg is not set and env variable ARG is not set you would expect the destination to be set to cli.NewStringSlice("foo")

                 var arg = cli.NewStringSlice()
		...
                  &cli.StringSliceFlag{
			Name:        "arg",
			EnvVars:     []string{"ARG"},
			Value:       cli.NewStringSlice("foo"),
			Destination: arg,
		},

I have quickly looked at how the string flag achieves this and tried to do similar.

@darren-west darren-west requested a review from a team as a code owner May 4, 2020 17:02
@darren-west darren-west requested review from saschagrunert and rliebz and removed request for a team May 4, 2020 17:02
Copy link
Member

@coilysiren coilysiren left a comment

Choose a reason for hiding this comment

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

Can you add a test to demonstrate the impact of this change?

@darren-west
Copy link
Author

I have added a test. The idea is that if the destination is set and the value is set but the flag is not set by env name or a program argument the value sets the destination. This is more consistent with how the other flags work (for instance StringFlag)

@erikwilson
Copy link

It looks like this is a duplicate of #1127?

@coilysiren
Copy link
Member

It does look like this is a duplicate!

@stale
Copy link

stale bot commented Sep 2, 2020

This issue or PR has been automatically marked as stale because it has not had recent activity. Please add a comment bumping this if you're still interested in it's resolution! Thanks for your help, please let us know if you need anything else.

@stale stale bot added the status/stale stale due to the age of it's last update label Sep 2, 2020
@stale
Copy link

stale bot commented Oct 3, 2020

Closing this as it has become stale.

@stale stale bot closed this Oct 3, 2020
@meatballhat meatballhat reopened this Apr 19, 2022
@meatballhat meatballhat removed the status/stale stale due to the age of it's last update label Apr 21, 2022
@meatballhat meatballhat changed the title Bug: StringSlice flags set to default Value StringSlice flags set to default Value Apr 21, 2022
@meatballhat meatballhat added kind/bug describes or fixes a bug area/v2 relates to / is being considered for v2 labels Apr 21, 2022
@meatballhat meatballhat added this to the Release 2.5.0 milestone Apr 21, 2022
@meatballhat meatballhat changed the base branch from master to main April 21, 2022 22:15
@meatballhat
Copy link
Member

Confirmed already fixed via #1127

Thank you all the same @darren-west!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants