Skip to content

✨ Omit hidden commands from typer ... utils docs output - #1989

Open
chrikrah wants to merge 1 commit into
fastapi:masterfrom
chrikrah:fix/docs-hidden-commands
Open

chrikrah wants to merge 1 commit into
fastapi:masterfrom
chrikrah:fix/docs-hidden-commands

Conversation

@chrikrah

Copy link
Copy Markdown

This extends hidden=True ("Hide this command from help outputs") to typer <app> utils docs. --help skips them, but the generated Markdown still lists hidden commands and sub-apps. Refs #1750, which the stale bot closed in June after its coverage check failed. Hidden options were already skipped.

$ typer tests.assets.cli.hidden_app utils docs --name hiddenapp
# master a5882de: lists `secret` and `internal`, plus sections for both and `internal rebuild`
# this branch:    only `public`
$ pytest tests/test_cli/test_doc.py -q
# a5882de with the new test: 1 failed (test_doc_hidden_commands), 8 passed
# this branch:               9 passed
$ TERMINAL_WIDTH=3000 _TYPER_FORCE_DISABLE_TERMINAL=1 pytest -q -n 4 [--cov on the branch]    # Python 3.12, Linux
# a5882de: 1473 passed, 30 skipped, 2 xfailed. this branch: 1474 passed, typer/cli.py at 100%
$ bash scripts/lint.sh    # mypy 2.4.1, ty 0.0.84, ruff 0.17.3
# clean

Docs that published a hidden command on purpose lose it, and I left an opt-in flag out until someone needs one. Should it land here instead?

Signed-off-by: Christopher Krah <48338417+chrikrah@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants