100 shell autocomplete, type fixes, Pillow deprecation cleanup #101

Merged
zach merged 7 commits from 100-cli-autocompletion into main 2026-05-26 13:10:56 +02:00
Showing only changes of commit d19eead1f5 - Show all commits
+16 -6
View File
@@ -28,14 +28,14 @@ def _completion_installed() -> bool:
return False return False
def _auto_install_completion() -> None: def _install_completion() -> None:
if not sys.stdout.isatty():
return
if _completion_installed(): if _completion_installed():
return click.echo("zshell-cli: Shell completion already installed.")
raise typer.Exit()
shell = _get_shell_name() shell = _get_shell_name()
if shell is None: if shell is None:
return click.echo("zshell-cli: Unable to detect shell type.", err=True)
raise typer.Exit(code=1)
try: try:
_, path = install(prog_name="zshell-cli") _, path = install(prog_name="zshell-cli")
click.secho(f"zshell-cli: Shell completion installed ({shell}: {path})", fg="green") click.secho(f"zshell-cli: Shell completion installed ({shell}: {path})", fg="green")
@@ -44,6 +44,16 @@ def _auto_install_completion() -> None:
pass pass
@app.callback()
def main_options(
install_autocomplete: bool = typer.Option(False, "--install-autocomplete", help="Install shell completion for tab-completion."),
):
if install_autocomplete:
_install_completion()
raise typer.Exit()
def main() -> None: def main() -> None:
_auto_install_completion() if sys.stdout.isatty() and not _completion_installed():
click.echo("zshell-cli: Tip: run with --install-autocomplete for tab completion.", err=True)
app() app()