click_config_file
click_config_file copied to clipboard
Don't require FILE for --config when implicit=False?
I'd like something like the following behavior when a configuration file setting name="Universe" is available at the default location, and name="Planet" is available at custom.cfg. In particular, I'd like the user to explicitly ask to load the configuration whenever it's used, but not require them to provide the path to the default location.
$ hello
Hello World!
$ hello --config
Hello Universe!
$ hello --config custom.cfg
Hello Planet!
$ hello --name Multiverse
Hello Multiverse!
$ hello --name Multiverse --config
Hello Multiverse!
I am maintaining click-extra, which seems to fix your issue as it respect by default the CLI > Configuration > Environment > Defaults precedence.
It also automatically search for a default configuration file in the default application folder.