allow multiple --config-file
Hello,
Thanks for configargparse!
I have a use-case where I'd like to specify --config-file multiple times on the command line and have all the config files used.
./application --config-file scenario-A.yaml --config-file common.yaml ./application --config-file scenario-B.yaml --config-file common.yaml
Where common.yaml holds the configs that are common between scenario A and B. But it appears that common.yaml just takes precedence over the scenario-*.yaml config files. I'd like both files to be used as they contain different key-value pairs.
I believe (know?) that I can have a separate option:
./application --config-file scenario-A.yaml --common-config common.yaml ./application --config-file scenario-B.yaml --common-config common.yaml
But that method lacks the elegance of the first option. It also (somewhat) violates the DRY principle as I'd simply like to specify the --config-file option multiple times.
Thanks for considering this feature request and thanks for configargparse!
-m
I guess you could do that with ENV or command line options. Use the config file for common options. Then use command line options for overriding the specifics. Also there is a default config file location, that can be overriden with --config-file. But using more than one implies ordering/stacking behavior. I can't think of an elegant way to handle that.
Hey Ronan,
On Thu, Jan 31, 2019 at 9:46 AM Ronan Delacroix [email protected] wrote:
I guess you could do that with ENV or command line options.
Sure. That is what I did:
'--secondary-config-file',
'-s',
is_config_file = True,
Use the config file for common options. Then use command line options for overriding the specifics.
One could. I'd rather keep everything in a config file - hence the "config" part of configargparse.
Also there is a default config file location, that can be overriden with --config-file. But using more than one implies ordering/stacking behavior.
No more of a ordering stacking behavior than using:
is_config_file = True
for multiple parameters.
I can't think of an elegant way to handle that.
I would pick an order and document it. If folks (like me) want to make use of multiple --config-file arguments, then we know what we're getting ourselves into.
That is, pick either:
first match wins or last match wins
for each argparse parameter.
Thanks for responding!
-m
This is a feature I would certainly be able to use. Multiple options or simply providing a list of config files in the first (and only) --config-file argument