-
|
I have this option: sources_directory: An[
Path,
cappa.Arg(
short="-s",
long=True,
default=FromConfig("index_sources_directory", "index.sources-directory"),
show_default="`index.sources-directory` config-value or `{default}`",
group=_GROUP_OPTIONS,
),
Doc("Directory where the sources are stored."),
] = defaults.DEFAULT_REPO_DIRI noticed that if I don't specify a value on the command line, Cappa will use the value obtained from my class Unset:
"""A sentinel value for unset configuration options."""
def __bool__(self) -> bool:
return False
def __repr__(self) -> str:
return "<unset>"
unset = Unset() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
I realize I could enhance FromConfig("index_sources_directory", "index.sources-directory", defaults.DEFAULT_REPO_DIR),...but I was wondering if there's a way to avoid repetition 🙂 |
Beta Was this translation helpful? Give feedback.
#196 for linking's sake.