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

Config paths that point to non-existing config files #80

Closed
hdevalence opened this issue Jul 8, 2019 · 1 comment
Closed

Config paths that point to non-existing config files #80

hdevalence opened this issue Jul 8, 2019 · 1 comment

Comments

@hdevalence
Copy link
Contributor

After implementing Configurable<FooConfig> for FooCommand to have config_path return the application's config path (and tweaking things so this is actually called, see #79 for notes on my confusion), my application exits with a hard error if a config file does not exist at the supplied path.

Ideally I would like the application to attempt to load a config from a supplied path, or use a set of defaults if that file doesn't exist.

The config_path documentation doesn't give details, but is it the responsibility of the config_path function to check whether the file exists and return None if not, or should it return the expected path for a config file, and have the config loading logic have responsibility for gracefully handling the case where the config is not supplied?

@tarcieri
Copy link
Collaborator

tarcieri commented Jul 8, 2019

This is a gross oversight in abscissa::command::EntryPoint. My apologies.

I agree it should attempt to source config_path from the underlying toplevel command it wraps unless one is provided explicitly as a command-line argument.

The intention is definitely that you can simply supply a path to load without checking it exists, and the framework will handle the file's absence by printing an error. If you would like to print a custom error rather than letting the framework handle it, you can check for the file's existence in advance (however note you won't get called in the event -c is passed).

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

No branches or pull requests

2 participants