-
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
Add StringMap flag #1580
Comments
@avorima We are not adding any new features to v2. Would you like to submit a PR for this for v3 ? |
Yeah, I can give it a shot. So do I use |
yes please use main. |
Will there be support for altsrc? |
@artemklevtsov would you like to submit a PR for altsrc ? |
Hm... I'll digging into it. |
@artemklevtsov Lets continue this conversation in issue #1634 |
Checklist
What problem does this solve?
There is no string mapping flag so I usually end up using a string slice and then splitting the elements into key/value pairs. pflag has the option to use the StringToString flag: https://github.com/spf13/pflag/blob/master/string_to_string.go.
Solution description
Add a
StringMapFlag
andStringMap
type that can be used likeStringSlice/Flag
, but is backed by amap[string]string
and splits the elements accordingly with validation. Separator could be configurable, but I think=
is a common default.Describe alternatives you've considered
Create a custom flag, but that would be even more boilerplate than now.
The text was updated successfully, but these errors were encountered: