Skip to content

Conversation

MorgenPronk
Copy link

@MorgenPronk MorgenPronk commented Aug 5, 2025

This PR adds a note in the README explaining that Typer treats single-command CLIs differently than multi-command CLIs.

This behavior can be surprising for new users (like myself), because calling the command by name (e.g., python cli.py hello Camila) results in an error when only one command is defined — Typer silently expects python cli.py Camila instead.

While this is explained in the full documentation, the README contains a similar example and is often the first place beginners look. A brief clarification here could help save users some confusion — especially those coming from FastAPI, where the number of wrapped functions doesn’t affect how the app is invoked.

Related issues:

#315 - this PR directly addresses confusion raised here.

#445 - is tangentially related in that it also highlights behavioral differences when only one subcommand exists.

I’ve also explored making this behavior configurable (i.e., supporting both styles of invocation), and I’d be happy to help further if there’s interest. But this change is a simple, non-breaking way to surface the existing behavior earlier for new users.

Let me know if you'd prefer the note be placed elsewhere, want to reword it, or would like help drafting a fuller fix later on.

@MorgenPronk MorgenPronk marked this pull request as draft August 5, 2025 07:36
@github-actions github-actions bot added the docs Improvements or additions to documentation label Aug 7, 2025
docs: emojis didn't seem to fit with the style of the document, so I removed them from the note about single vs multi command modes.

🎨 [pre-commit.ci] Auto format from pre-commit.com hooks

chore: Updated docs/index.md to include the note on single vs Multi-command mode in the readme file to avoid confusion for new users.

docs: used scripts/docs.py generate-readme to generate new README.md file
@MorgenPronk MorgenPronk force-pushed the docs/single-command-note branch from 3eca414 to 4163446 Compare August 7, 2025 04:59
Copy link
Contributor

github-actions bot commented Aug 7, 2025

📝 Docs preview for commit e8caa61 at: https://2715fc60.typertiangolo.pages.dev

Modified Pages

@MorgenPronk MorgenPronk marked this pull request as ready for review August 7, 2025 05:09
@svlandeg svlandeg changed the title docs: clarify single-command vs multi-command behaviour in README 📝 Clarify single-command vs multi-command behaviour in README Aug 18, 2025
Copy link
Contributor

github-actions bot commented Sep 4, 2025

📝 Docs preview for commit 46d35a4 at: https://b52c28c7.typertiangolo.pages.dev

Modified Pages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant