feat: turn boolean settings into CLI flags
This commit is contained in:
@@ -213,6 +213,7 @@ class Settings(BaseSettings):
|
|||||||
toml_file="config.toml",
|
toml_file="config.toml",
|
||||||
env_prefix="HERETIC_",
|
env_prefix="HERETIC_",
|
||||||
cli_parse_args=True,
|
cli_parse_args=True,
|
||||||
|
cli_implicit_flags=True,
|
||||||
cli_kebab_case=True,
|
cli_kebab_case=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -65,10 +65,11 @@ def run():
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
# An odd number of arguments have been passed (argv[0] is the program name),
|
# There is at least one argument (argv[0] is the program name).
|
||||||
# so that after accounting for "--param VALUE" pairs, there is one left over.
|
len(sys.argv) > 1
|
||||||
len(sys.argv) % 2 == 0
|
# No model has been explicitly provided.
|
||||||
# The leftover argument is a parameter value rather than a flag (such as "--help").
|
and "--model" not in sys.argv
|
||||||
|
# The last argument is a parameter value rather than a flag (such as "--help").
|
||||||
and not sys.argv[-1].startswith("-")
|
and not sys.argv[-1].startswith("-")
|
||||||
):
|
):
|
||||||
# Assume the last argument is the model.
|
# Assume the last argument is the model.
|
||||||
|
|||||||
Reference in New Issue
Block a user