by nmz · 2y ago · 0 comments
A good option package should support long options being both command line flags and environment variables. The really good ones support them in init files as well (I'm partial to the JSON-ish HOCON format, though .INI works too).
I always spec (later overrides previous settings):
- system default (/etc/foo.conf)
- user defaults (~/.foo.conf)
- local defaults (${CWD}/foo.conf)
- user-specified init file (overrides local default)
- environment vars (FOO_OUTPUT=JSON)
- command line var (--output=json)
As well as --no-init and --no-env