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
@app.command()defcreate(
username: Annotated[str, typer.Argument(help="The username to create")],
lastname: Annotated[
str,
typer.Argument(
help="The last name of the new user", rich_help_panel="Secondary Arguments"
),
] ="",
force: Annotated[bool, typer.Option(help="Force the creation of the user")] =False,
age: Annotated[
Union[int, None],
typer.Option(help="The age of the new user", rich_help_panel="User Options"),
] =None,
favorite_color: Annotated[
Union[str, None],
typer.Option(
help="The favorite color of the new user",
rich_help_panel="Output Options",
),
] =None,
):
""" [green]Create[/green] a new user. :sparkles: """print(f"Creating user: {username}")
Description
Is there a way to add prolog and/or epilog to a rich_help_panel so that the output is something like this:
python main.py create --help
Usage: main.py create [OPTIONS] USERNAME [LASTNAME]
Create a new user. ✨
╭─ Arguments ───────────────────────────────────────────────────────╮
│ * username TEXT The username to create [default: None] │
│ [required] │
╰───────────────────────────────────────────────────────────────────╯
╭─ Secondary Arguments ─────────────────────────────────────────────╮
│ lastname [LASTNAME] The last name of the new user │
╰───────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────╮
│ General options which apply to all commands. │
│ --force --no-force Force the creation of the user │
│ [default: no-force] │
│ --help Show this message and exit. │
╰───────────────────────────────────────────────────────────────────╯
╭─ User Options ───────────────────────────────────────────────────╮
│ Options controlling users │
│ --age INTEGER The age of the new user │
│ [default: None] │
╰───────────────────────────────────────────────────────────────────╯
╭─ Output Options ─────────────────────────────────────────────────╮
│ Options controlling output │
│ --favorite-color TEXT The favorite color of the new │
│ user │
│ [default: None] │
│ Example: │
│ lkskdflsdkf │
╰───────────────────────────────────────────────────────────────────╯
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
Is there a way to add prolog and/or epilog to a rich_help_panel so that the output is something like this:
Operating System
Linux
Operating System Details
No response
Typer Version
0.15.1
Python Version
3.13
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions