Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support CLI arguments via config file #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gitolicious
Copy link
Collaborator

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 gitolicious requested a review from rbignon July 19, 2021 19:45
@rbignon
Copy link
Owner

rbignon commented Jul 20, 2021

Hi gitolicious,

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

@gitolicious
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Are we getting too many CLI arguments?
2 participants