ConfigArgParse icon indicating copy to clipboard operation
ConfigArgParse copied to clipboard

Add option to ignore previous config files

Open mathisloevenich opened this issue 3 years ago • 3 comments

If default_config_files is set to:

["/etc/conf/app_config.ini",
 "/etc/conf/conf-enabled/*.ini",
 "~/.my_app_config.ini",
 "./app_config.txt"]

It would be nice to be able to tell which one was used.

Something like: get_used_config_path()

Or let parse_args return the used config path if found

mathisloevenich avatar Oct 28 '21 11:10 mathisloevenich

I recognized the following behaviour:

/etc/conf/app_config.ini

value = 1
ignore-value = 2

./app_config.txt

value = 100

parse_args() returns: Namespace(value=100, ignore_value=1)

But it would be nice to actually ignore previous variables and config files

What I want to get is: Namespace(value=100)

mathisloevenich avatar Oct 28 '21 13:10 mathisloevenich

and then obviously it would be nice to know which one was used (if there are multiple config files found)

mathisloevenich avatar Oct 29 '21 09:10 mathisloevenich

The format_values() method reports where an arg came from. The ignore behavior is not something that many people would want AFAIK.

bw2 avatar Jan 26 '22 03:01 bw2