-
Notifications
You must be signed in to change notification settings - Fork 5
bug: arrays not being returned correctly #24
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
Comments
Additional note: I noticed that https://github.com/urfave/cli-altsrc/blob/main/toml/toml_map.go is no longer being used and should probably be removed. |
@deadprogram That seems to be correct. Would you like to open a PR and submit changes for this ? |
@dearchap what is the correct change to be made in your opinion? I don't mind helping out if I can get pointed in the correct direction. |
@deadprogram Actually the behavior of toml is exactly as expected. It will return a |
@dearchap perhaps you can then point me towards the appropriate place in the main CLI for such a change? |
https://github.com/urfave/cli/blob/main/flag_slice_base.go#L37 The other option is to check for slices in this library and strip away the square brackets for returning to the user. |
@deadprogram Actually you dont need to change the cli code. You just need to change the code here https://github.com/urfave/cli-altsrc/blob/main/altsrc.go#L118 . We are returning a string(with brackets) from a slice. What you can do is remove the brackets from string if value is a slice |
@dearchap I tried what you suggested, however it did not appear to work. |
@deadprogram Can you send a PR with the change ? We can look at it |
Uh oh!
There was an error while loading. Please reload this page.
UPDATE: arrays of any type (int, string) are not being parsed correctly for any source format: JSON, TOML, and YAML.
When trying to populate a flag containing a string array coming from a TOML file, I discovered that instead of returning a slice with one string per array item, instead it is returning a slice with a single string that contains the entire array.
I added a unit test that demonstrates the problem in a fork/branch:
Here is a commit with the failing test:
hybridgroup@8d09ba6
Thanks for any help!
The text was updated successfully, but these errors were encountered: