bw2 / ConfigArgParse

A drop-in replacement for argparse that allows options to also be set via config files and/or environment variables.
MIT License
719 stars 121 forks source link

Are there config file includes (do config file attributes get parsed when they're in yaml) #272

Open ridilculous opened 2 years ago

ridilculous commented 2 years ago

Maybe this is already possible and i just don't know how to use it.

Is there a way for a config file to include another config file, i.e. split and reuse config files partially?

Multiple config files can be configured and they are recognized when they're all passed through command line, but whatever i try, i cannot specify the same or another config file within a existing config file.

Here's what i tried:

Parser fragment:

parser.add("-cfg", "--configFile", is_config_file=True)
parser.add("-cfg2", "--configFile2", is_config_file=True)
kyduff commented 2 years ago

I am also looking for the same functionality. Perhaps support for the !includes directive is a worthy feature? Something as in this stackoverflow example could be very useful.

bw2 commented 1 year ago

A PR to add this would be appreciated.