Proposal: support standard library flag provider
beihai0xff opened this issue · comments
I use the golang standard library flag to parse command line parameters, for which I implements a stdflag Provider
The stdflag Provider parses the command line parameters into a map[string]interface{} and then passes it to koanf.
Similar to the posflag Provider, if a key already exists in koanf and also exists in flagset, but the value in flagset is the default value, then the key will not be overwritten
The stdflag Provider also provides a callback function to modify the key and value of the command line parameters.
If you interested in this, I can submit a PR to add this Provider to koanf.
you can read the code here: Add new stdflag provider for reading command line parameters
Thanks @beihai0xff. Couldn't this functionality be added as optional behaviour to the bundled basicflag
provider?
Couldn't this functionality be added as optional behaviour to the bundled basicflag provider?
Sorry, I didn't see the basicflag Provider. I will merge stdflag
Provider to basicflag
Provider.