iniflags
iniflags copied to clipboard
pflag?
I like the way this library goes about solving the go config issue.
I suspect this could this be made to work with pflag? https://github.com/ogier/pflag. Do you see it being a real simple change if I forked this project (or if you added the feature), or do you foresee some messiness?
pflag mimics the standard flag library but adds some constructors for supplying both 1-character flags and multi-character flags (like --help).
Thanks!
- Jon
It would be really cool if Go supported try/except imports like in Python, but currently it does not, so I see no easy way to make the library work with native flags and pflag if it is installed, what solution do you have in mind ?
I don't have any good solutions. Sorry.
Most of the logic in the "flag" package is actually wrapped in the "CommandLine" singleton (instance of FlagSet), so if you had a FlagSet interface that both flag and pflag support (or at least pflag can be wrapped to support), then I imagine the code could be adjusted to support both cases.
This would mean replacing usage of convenience methods which assume we are talking about the command line flag set, such as flag.Lookup()