doctoshotgun
doctoshotgun copied to clipboard
support CLI arguments via config file
I found a quick way of supporting a config file with fromfile-prefix-chars
in the argparse library.
Would have preferred a nicely structured YAML file, but this was a quick win, so I couldn't resist.
Fixes #84.
Hi gitolicious,
To parse from a yaml config file, you can use jsonargparse: https://jsonargparse.readthedocs.io/en/stable/ (see the "Configuration files" section)
I actually have a mostly working version with a YAML config file, but merging YAML parameters with the current CLI arguments (especially the unnamed, required ones) in a reasonable way gave me headaches. This one-liner (actually half a line) solution then looked good enough for me as it is perfectly compatible with the current implementation.