parameters.md
This file
Path
docs/reference/parameters.md
31 lines 路 703 bytes 路 Markdown
Last changed by
馃摑 Add reference (code API) docs (#1504)Sofie Van Landeghembefore adoption2d529b2
History of this fileTake it
parameters.md
Parameters
Parameters to our command line interface may be both CLI Options and CLI Arguments:
from typing import Annotated
import typer
app = typer.Typer()
@app.command()
def register(
user: Annotated[str, typer.Argument()],
age: Annotated[int, typer.Option(min=18)],
score: Annotated[float, typer.Option(max=100)] = 0,
):
print(f"User is {user}")
print(f"--age is {age}")
print(f"--score is {score}")
if __name__ == "__main__":
app()
::: typer.Argument options: show_overloads: false
::: typer.Option options: show_overloads: false