-
Notifications
You must be signed in to change notification settings - Fork 350
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
Added StringArray Function #181
base: master
Are you sure you want to change the base?
Conversation
fabe77a
to
84fadfb
Compare
84fadfb
to
c43137b
Compare
You added a new function to every defined type which appears to only have meaning on StringArray and StringSlice. Why? If it isn't part of the Value interface no one can come to rely on it generically, so they would have had to cast to a specific pflag type. And if they cast to a specific pflag type why would they bother to use StringArray() for any other types? My second question is, what type of string can't be packed/unpacked with a CSV? Can you write some test that shows the problem? |
The specific CLI command using
It works with this PR. I first tried a quick hack in |
Are there any outstanding questions that I can help answer? Thanks for consideration. |
@pjdufour is this change still of interest to you? I am bumping up against similar limitations, and I'm considering creating something like a SliceValue and ArrayValue interface to export list-specific functions for Viper to consume. Interested in collaborating? |
This PR adds a
StringArray() []string
function to each value. I will make a PR toviper
after this is merged, so that the StringArray variables use this new function. This is needed since binding topflag
prevents the use of values that can't be packed/unpacked using CSV. With this function,viper
can pull array values directly frompflag
maintaining the original values.