bw2 / ConfigArgParse

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

Exclude config file option when writing out a config file #181

Closed wvoigt closed 4 years ago

wvoigt commented 4 years ago

Currently, writing out a config file includes all the options given, including those in the config file (good) but also the command line config file option itself (not always desirable.)

If an output file is directly used as an input config file, it should no longer need the original config file option - the options from that file are already included in the written config file.

I can see the logic for the way it is, but I think it would be good to have an option to not include the config file as well. That way the the direct use of the written config file does not needlessly load in the old config again. The options in that old config file will just all be overridden by options in the newer config file.

wvoigt commented 4 years ago

Never mind. It is written into the output file if a '--' is given. But not if only a '-' is given. I have a work around.