-
Notifications
You must be signed in to change notification settings - Fork 347
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
Add map valued (string->string, string->int) flags. #133
Conversation
@eparis, mind taking a look? |
@tamalsaha why was this closed? it's still a useful implementation unless there is now some other way to accomplish now? |
Because it did not seem that it will get merged. Our fork is maintained. |
somehow I totally missed this.... sorry.... |
string_to_string.go
Outdated
|
||
// Format: a=1,b=2 | ||
func (s *stringToStringValue) Set(val string) error { | ||
ss := strings.Split(val, ",") |
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.
Should this actually be a CSV decode, instead of just splitting on ,? What is there is a comma in the value?
Thanks @eparis ! I have addressed your comment. PTAL. |
that's really awesome! If you'll write a test of the csv stuff, I'll merge it! |
I added some tests here: |
Format: --myflag=a=1,b=2
Added even more tests, Search for |
this is awesome thanks guys! 💯 |
@tamalsaha Does |
It is not supported.See the comment #179 |
I see, OK. This comment indicates that |
Try passing this flag like this |
Nope, getting an error: |
Here is the code that does the parsing. https://github.com/spf13/pflag/pull/179/files#diff-1ace98db8b8888abf672baa63775bc05R24 This should work: https://play.golang.org/p/rIAPpDsiHJQ The code is using CSV reader. Did you use the double quote? |
OK @tamalsaha this worked for me: |
Format: --myflag=a=1,b=2
ref: #129