doctoshotgun icon indicating copy to clipboard operation
doctoshotgun copied to clipboard

support CLI arguments via config file

Open gitolicious opened this issue 2 years ago • 2 comments

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.

gitolicious avatar Jul 19 '21 19:07 gitolicious

Hi gitolicious,

To parse from a yaml config file, you can use jsonargparse: https://jsonargparse.readthedocs.io/en/stable/ (see the "Configuration files" section)

rbignon avatar Jul 20 '21 07:07 rbignon

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.

gitolicious avatar Jul 20 '21 17:07 gitolicious