I used to wish for that too but I have changed my mind. I think in real world applications with many options it is preferable to not allow every option to be set in every way.
Environment variables shine for properties that vary per instances which share config files and for system properties (think $GOMAXPROCS).
Secrets should never go in the command line nor the environment.
There is no one size fits all. Arguments, environment and config files have different pros and cons and should be used accordingly.
I did that for Python if you are interested: https://github.com/kdeldycke/click-extra
You create your CLI with Click as usual, then Click Extra introspects your "--parameters" to build up support for a corresponding configuration file in either TOML, YAML, JSON, INI or XML.
Edit: If there’s demand I’d be willing to better document it.
verbose
show-machine-names
remoteshell ssh
forklimit 4
TBH, I quite like it. Less to memorize, easy to know what to override, etc.
My holy grail will still be landing on a good multi-layer configuration setup for Rust CLIs. Ideally CLI flags merged over top of environment variables merged over top of configuration files.
Twelf [0] was close in unifying things, but I had some friction. Lately I've been using Schematic [1] to handle the environment + config layers, and then just a manual implementation of Clap arguments layered on top.
[0] https://github.com/bnjjj/twelf.
[1] https://github.com/moonrepo/schematic