Skip to content

Commit abaeba4

Browse files
feat(cli): enable shell completion for bash/zsh/fish
Closes #166.
1 parent 0a5bb09 commit abaeba4

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ uv sync
5959
uv run create-awesome-python-app --help
6060
```
6161

62+
### Shell completion
63+
64+
```bash
65+
create-awesome-python-app --install-completion # bash / zsh / fish
66+
create-awesome-python-app --show-completion # print script only
67+
```
68+
6269
## License
6370

6471
MIT — see [LICENSE](./LICENSE).

packages/create-awesome-python-app/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,18 @@ uv run create-awesome-python-app --help
99
uvx create-awesome-python-app@latest my-app # after PyPI publish
1010
pipx run create-awesome-python-app my-app
1111
```
12+
13+
## Shell completion
14+
15+
Typer installs completion scripts for bash, zsh, and fish:
16+
17+
```bash
18+
# Interactive install into your shell profile
19+
create-awesome-python-app --install-completion
20+
21+
# Or print the script and source it manually
22+
create-awesome-python-app --show-completion
23+
```
24+
25+
After installing, restart the shell (or `source` your profile) and tab-complete
26+
flags such as `--template`, `--addons`, and `cache` subcommands.

packages/create-awesome-python-app/src/create_awesome_python_app/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
name="create-awesome-python-app",
2929
help="Composable scaffolding CLI for production-ready Python apps.",
3030
no_args_is_help=False,
31-
add_completion=False,
31+
add_completion=True,
3232
)
3333
cache_app = typer.Typer(help="Inspect and manage the local template cache")
3434
app.add_typer(cache_app, name="cache")

packages/create-awesome-python-app/tests/test_flags.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ def test_help_lists_scaffold_flags() -> None:
2323
"--set",
2424
"--force",
2525
"--no-install",
26+
"--install-completion",
27+
"--show-completion",
2628
]:
2729
assert flag in text

0 commit comments

Comments
 (0)