Skip to content

Conversation

@savannahostrowski
Copy link
Member

@savannahostrowski savannahostrowski commented Oct 8, 2025

This PR adds a common CLI feature to Typer, which allows users to get suggestions for command typos out of the box. No extra dependency or work required!

Usage

import typer

app = typer.Typer()

@app.command()
def create():
    typer.echo("Creating...")

@app.command()
def delete():
    typer.echo("Deleting...")

if __name__ == "__main__":
    app()

If a user were to type crate instead of create, they would then see an error message like so:

Error: No such command 'crate'. Did you mean 'create'?

@savannahostrowski savannahostrowski added the feature New feature, enhancement or request label Oct 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

@svlandeg svlandeg self-assigned this Oct 9, 2025
Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a great feature to have, and I would have even wanted to enable this by default. But to minimize unexpected impact on users it probably makes sense to have it disabled by default as you suggest.

Love all the tests, went through it all and all looked good. Addition to the tutorial is perfect and the added code is minimal and clean.

Could really only find the smallest of nitpicks, but happy to approve either way. 😉

@svlandeg svlandeg removed their assignment Oct 10, 2025
@savannahostrowski savannahostrowski changed the title ✨ Add optional parameter to enable command suggestions ✨ Enable command suggestions on typo by default Oct 20, 2025
Copy link
Member

@tiangolo tiangolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you! 🚀


Note: just for completeness, I asked on another channel to have this enabled by default, so it is now on by default. 😎 🎉


This will be available in the next hours in Typer 0.20.0.

@tiangolo tiangolo enabled auto-merge (squash) October 20, 2025 16:55
@tiangolo tiangolo disabled auto-merge October 20, 2025 17:00
@tiangolo tiangolo merged commit f6718b8 into fastapi:master Oct 20, 2025
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature, enhancement or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants