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

fix #1121(StringSliceFlag set default value into destination) #1127

Merged
merged 2 commits into from Jun 4, 2020

Conversation

sgoroshko
Copy link
Contributor

@sgoroshko sgoroshko commented May 1, 2020

What type of PR is this?

(REQUIRED)

  • bug
  • cleanup
  • documentation
  • feature

What this PR does / why we need it:

default value does not set in Destination field in StringSliceFlag.

Which issue(s) this PR fixes:

#1121

Release Notes

(REQUIRED)

 - fix bug, default value does not set in Destination field in StringSliceFlag.

@sgoroshko sgoroshko requested a review from a team as a code owner May 1, 2020 20:14
@sgoroshko sgoroshko requested review from coilysiren and asahasrabuddhe and removed request for a team May 1, 2020 20:14
Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

This now seems to be a duplicate of #1123

@coilysiren
Copy link
Member

This definitely looks like a duplicate of #1123

@sgoroshko & @atif-konasl can you both have a conversation about whose solution you think should move forward? We can't merge both

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.

feel free to re-request me when the duplication between #1127 and #1123 is resolved!

@atif-konasl
Copy link

@lynncyrin & @sgoroshko ,
i deleted my PR.

coilysiren
coilysiren previously approved these changes May 6, 2020
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.

LGTM

@coilysiren
Copy link
Member

ping @urfave/cli for a review here! 👋

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@rliebz rliebz left a comment

Choose a reason for hiding this comment

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

Thanks for pulling this fix together.

One main question here—Is this not a problem for other slice flags as well (int, int64, float)? While it's important we get fixes like this in, it's also necessary that we have consistent behavior between the flag types.

@@ -116,6 +116,14 @@ func (f *StringSliceFlag) GetValue() string {

// Apply populates the flag given the flag set and environment
func (f *StringSliceFlag) Apply(set *flag.FlagSet) error {

if f.Destination != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: These nested if statements can be collapsed

if f.Destination != nil && f.Value != nil {

Copy link
Member

Choose a reason for hiding this comment

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

Bump.

@sgoroshko
Copy link
Contributor Author

Thanks for pulling this fix together.

One main question here—Is this not a problem for other slice flags as well (int, int64, float)? While it's important we get fixes like this in, it's also necessary that we have consistent behavior between the flag types.

Float64SliceFlag - have no destination field
Int64SliceFlag - have no destination field
IntSliceFlag - have no destination field

@sgoroshko sgoroshko closed this May 22, 2020
@sgoroshko sgoroshko reopened this May 22, 2020
@sgoroshko sgoroshko requested a review from rliebz May 22, 2020 03:54
@rliebz
Copy link
Member

rliebz commented May 22, 2020

Weird that they don't have a destination field, but definitely not a requirement for this change to fix that.

saschagrunert
saschagrunert previously approved these changes May 23, 2020
Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

@sgoroshko sgoroshko dismissed stale reviews from saschagrunert and coilysiren via 10fe017 May 31, 2020 17:52
@sgoroshko
Copy link
Contributor Author

fix nested conditions

@coilysiren
Copy link
Member

🚢

@coilysiren coilysiren merged commit b190f2d into urfave:master Jun 4, 2020
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.

None yet

5 participants