You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the GitHub search to find a similar question and didn't find it.
I searched the Typer documentation, with the integrated search.
I already searched in Google "How to X in Typer" and didn't find any information.
I already read and followed all the tutorials in the docs and didn't find an answer.
I already checked if it is not related to Typer but to Click.
Commit to Help
I commit to help with one of those options 👆
Example Code
importtyperfromtyping_extensionsimportAnnotatedapp=typer.Typer(rich_markup_mode="rich")
@app.command()defhello(
name: Annotated[
str, typer.Option(help="The [bold]cool[/bold] name of the [green]user[/green]")
],
):
""" Say [bold]hi[/bold] to the user. """print(f"Hello {name}")
@app.command()defgoodbye(
name: Annotated[
str, typer.Option(help="The [bold]cool[/bold] name of the [green]user[/green]")
],
):
""" Say [bold]goodbye[/bold] to the user. """print(f"Goodbye {name}")
if__name__=="__main__":
app()
Description
Create this script in main.py
In Zsh, start running it with the typer command, start typing: typer main.py run , then hit tab to trigger autocompletion, it shows the two commands, which is correct:
goodbye
hello
But their Zsh help string includes the Rich markup content:
$ typer main.py run <tab>
goodbye -- Say [bold]goodbye[/bold] to the user.
hello -- Say [bold]hi[/bold] to the user.
It should show plaintext without [bold] markup parts... or better, it should render those parts and show them in actual green color (using the terminal color codes, etc, the stuff Rich does).
Operating System
Linux, macOS
Operating System Details
This applies mainly to Zsh, the behavior might be similar or different in PowerShell. It only applies in shells that can show autocompletion of commands with help sections.
Typer Version
Typer version: 0.12.3
Python Version
any
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Looking into this! It took me a little while to get started, because I couldn't get autocompletion to work in zsh with Git bash for Windows. It works now thanks to #237, so I'm looking into this next 🙂
Discussed in #821
Originally posted by tiangolo May 2, 2024
First Check
Commit to Help
Example Code
Description
Create this script in
main.py
In Zsh, start running it with the
typer
command, start typing:typer main.py run
, then hit tab to trigger autocompletion, it shows the two commands, which is correct:goodbye
hello
But their Zsh help string includes the Rich markup content:
It should show plaintext without
[bold]
markup parts... or better, it should render those parts and show them in actual green color (using the terminal color codes, etc, the stuff Rich does).Operating System
Linux, macOS
Operating System Details
This applies mainly to Zsh, the behavior might be similar or different in PowerShell. It only applies in shells that can show autocompletion of commands with help sections.
Typer Version
Typer version: 0.12.3
Python Version
any
Additional Context
No response
The text was updated successfully, but these errors were encountered: