It'd be great to add an option to enable skipping default config files. It'd resolve https://github.com/romanz/electrs/issues/217 as well as provide some robustness for other interesting cases. Programs that don't have such options are sometimes painful to work with (pkg-config comes to mind).
Proposed solution: make it possible to add skip_default_configs to a boolean flag. After processing arguments, this is checked and configs are not loaded if it's set to true.
Pros:
Looks very easy to implement
Implicitly prevents people from making two different options of the same name (because of the field name in the struct).
Makes it possible to access this value - e.g. for logging purposes
No need to write a separate documentation generating code
Cons:
One might accidentally make more than one such option - this would work, but it'd be weird - maybe issue a warning?
It leaks the value, cementing the implementation detail immediately, removing the ability to change it in the future
It forces everyone to document this option, while it might be entirely fine to provide doc string automatically. Maybe we could set it as the default, but I'm not sure if it'd be easy enough.
Alternatives:
Silently ignore bunch of other errors (e.g. EPERM) - lot of hair pulling in cases where the user forgot didn't want this behavior.
Print warning if a file is skipped because of any other reason - annoying warning clutter for projects that'd need this feature
Make this option always present in configure_me - would remove configuration handling, but be inflexible. There's a precedent with --help, but that is extremely widespread - basically every program understands -h and --help. This isn't true for skipping default config.
Adding "bug" label because the inability to turn off default configs can be highly problematic in certain situations. I'm going ahead and implement this unless someone raises important objection.
It'd be great to add an option to enable skipping default config files. It'd resolve https://github.com/romanz/electrs/issues/217 as well as provide some robustness for other interesting cases. Programs that don't have such options are sometimes painful to work with (pkg-config comes to mind).
Proposed solution: make it possible to add
skip_default_configs
to a boolean flag. After processing arguments, this is checked and configs are not loaded if it's set to true.Pros:
Cons:
Alternatives:
EPERM
) - lot of hair pulling in cases where the user forgot didn't want this behavior.configure_me
- would remove configuration handling, but be inflexible. There's a precedent with--help
, but that is extremely widespread - basically every program understands-h
and--help
. This isn't true for skipping default config.