feat: turn boolean settings into CLI flags

This commit is contained in:
Philipp Emanuel Weidmann
2025-12-07 11:37:07 +05:30
parent ffbde3ac2a
commit 24c3aeb442
2 changed files with 6 additions and 4 deletions
+1
View File
@@ -213,6 +213,7 @@ class Settings(BaseSettings):
toml_file="config.toml",
env_prefix="HERETIC_",
cli_parse_args=True,
cli_implicit_flags=True,
cli_kebab_case=True,
)
+5 -4
View File
@@ -65,10 +65,11 @@ def run():
print()
if (
# An odd number of arguments have been passed (argv[0] is the program name),
# so that after accounting for "--param VALUE" pairs, there is one left over.
len(sys.argv) % 2 == 0
# The leftover argument is a parameter value rather than a flag (such as "--help").
# There is at least one argument (argv[0] is the program name).
len(sys.argv) > 1
# No model has been explicitly provided.
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("-")
):
# Assume the last argument is the model.