running without arguments prints the help

This commit is contained in:
2026-05-10 16:52:31 +02:00
parent 5a2844c7cb
commit 150cc57932
2 changed files with 19 additions and 1 deletions
+11 -1
View File
@@ -25,7 +25,8 @@ app = typer.Typer(
"- By default, Chromy uses Chroma's default persistent location behavior.\n"
f"- Set {CHROMA_FOLDER_ENV_VAR} to a parent directory to override it.\n"
f"- Chromy stores data in <{CHROMA_FOLDER_ENV_VAR}>/chroma."
)
),
invoke_without_command=True,
)
ExitCodeHandler = Callable[[], int]
@@ -46,6 +47,15 @@ def _fail(message: str) -> None:
raise typer.Exit(1)
@app.callback()
def main(ctx: typer.Context) -> None:
"""Run the CLI and show help when no command is provided."""
if ctx.invoked_subcommand is None:
print("[bold red]Error[/]: Missing command.")
typer.echo(ctx.get_help())
raise typer.Exit(1)
# ------------------------------------------------------------------------------
# LIST COLLECTIONS
# ------------------------------------------------------------------------------