diff --git a/README.md b/README.md index 4cf7a4e..81ad28b 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,13 @@ uv sync uv run create-awesome-python-app --help ``` +### Shell completion + +```bash +create-awesome-python-app --install-completion # bash / zsh / fish +create-awesome-python-app --show-completion # print script only +``` + ## License MIT — see [LICENSE](./LICENSE). diff --git a/packages/create-awesome-python-app/README.md b/packages/create-awesome-python-app/README.md index 8575eba..2f90100 100644 --- a/packages/create-awesome-python-app/README.md +++ b/packages/create-awesome-python-app/README.md @@ -9,3 +9,18 @@ uv run create-awesome-python-app --help uvx create-awesome-python-app@latest my-app # after PyPI publish pipx run create-awesome-python-app my-app ``` + +## Shell completion + +Typer installs completion scripts for bash, zsh, and fish: + +```bash +# Interactive install into your shell profile +create-awesome-python-app --install-completion + +# Or print the script and source it manually +create-awesome-python-app --show-completion +``` + +After installing, restart the shell (or `source` your profile) and tab-complete +flags such as `--template`, `--addons`, and `cache` subcommands. diff --git a/packages/create-awesome-python-app/src/create_awesome_python_app/cli.py b/packages/create-awesome-python-app/src/create_awesome_python_app/cli.py index 5979491..e94e22a 100644 --- a/packages/create-awesome-python-app/src/create_awesome_python_app/cli.py +++ b/packages/create-awesome-python-app/src/create_awesome_python_app/cli.py @@ -28,7 +28,7 @@ name="create-awesome-python-app", help="Composable scaffolding CLI for production-ready Python apps.", no_args_is_help=False, - add_completion=False, + add_completion=True, ) cache_app = typer.Typer(help="Inspect and manage the local template cache") app.add_typer(cache_app, name="cache") diff --git a/packages/create-awesome-python-app/tests/test_flags.py b/packages/create-awesome-python-app/tests/test_flags.py index 08b37b5..2082817 100644 --- a/packages/create-awesome-python-app/tests/test_flags.py +++ b/packages/create-awesome-python-app/tests/test_flags.py @@ -23,5 +23,7 @@ def test_help_lists_scaffold_flags() -> None: "--set", "--force", "--no-install", + "--install-completion", + "--show-completion", ]: assert flag in text