-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Feature: (issue_1451) customized slice flag separator #1546
Feature: (issue_1451) customized slice flag separator #1546
Conversation
53f1b5e
to
2d390e9
Compare
The setting of "SliceFlagSeparator" is "global-level" because it is necessary to keep the same separator for each "sliceFlag". Therefore it is not set to "flag-level" |
b012801
to
ba36536
Compare
@dearchap Please help me, why does "CI" keep failing?😭 |
Can you do a gofmt or goimports in main dir ? |
ba36536
to
c3675c0
Compare
I did gofmt&goimports for the "flag_test.go" file, but it still failed. |
dffd74a
to
f71906f
Compare
282d0a0
to
2f10ac7
Compare
@dearchap Please help me review the code, I rely on this feature to do my work!💕💕💕 |
2f10ac7
to
c5da5f6
Compare
flag_test.go
Outdated
} | ||
|
||
_ = app.Run(os.Args) | ||
defaultSliceFlagSeparator = "," |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to add the revert of defaultSliceFlagSeparator in a defer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
flag_test.go
Outdated
} | ||
app.SliceFlagSeparator = ";" | ||
app.Action = func(ctx *Context) error { | ||
ret := ctx.StringSlice("stringSlice") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its better not to rely on Action here. If action doesnt get called the test would pass. why dont you set the destination filed of the string slice flag and then validate the slice contents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done! ✌️
ad7dfde
to
957957f
Compare
What type of PR is this?
feature
(REQUIRED)
What this PR does / why we need it:
add customized slice flag separator
(REQUIRED)
Which issue(s) this PR fixes:
Feature #1541
(REQUIRED)
Special notes for your reviewer:
(fill-in or delete this section)
Testing
(fill-in or delete this section)
Release Notes
(REQUIRED)