No. The program reads a general config file in $HOME, something like
~/.programrc; then parses the command like for '-c FILE' and, if FILE is
present reads it; then parses the command line remains for more
arguments which overwrite everything previously set. (For the record,
this split parsing is done with two argparse parsers. The first parses
for '-c FILE' with parse_known_args(). If there is a FILE, its contents
is used as defaults for a second parser (using set_options()) which then
parses the remains that were returned by the first parser's
parse_known_args().)
But now I would also like to be able to _write_ such a config file FILE
that can be read in a later run. And FILE should contain only those
arguments that were given on the command line.
Say, I tell argparse to look for arguments -s|--sopt STRING, -i|--iopt
INT, -b|--bopt [BOOL], -C CONFFILE. Then 'prog -s bla -i 42 -C cfile'
should produce a confparser compatible cfile which contains
[my_options]
sopt = blah
iopt = 42
and not 'bopt = False' (if False was the program's default for bopt).
Regards,
Henry