Skip to content

Re-using Typer Options

Overview

Options used for multiple commands can be defined at a common place. This makes the option name and docs consistent.

Example

Define the option:

short_name_option: str = typer.Option(
    None,
    help="The short name of the talk.",
)

Reference the option in the command argument:

@app.command()
def create(
    short_name: str = short_name_option,

More Info