6 Matching Annotations
- Dec 2022
-
www.it.uu.se www.it.uu.se
Tags
Annotators
URL
-
-
erlang.org erlang.org
Tags
Annotators
URL
-
- Aug 2020
-
typer.tiangolo.com typer.tiangolo.com
-
def main(name: str = typer.Argument("World", hidden=True)):
Hide a CLI argument from the help text
-
def main(name: str = typer.Argument(..., help="The name of the user to greet")): typer.echo(f"Hello {name}")
Add a help text for a CLI argument You can use the help parameter to add a help text for a CLI argument. This example without default
Tags
Annotators
URL
-
-
typer.tiangolo.com typer.tiangolo.com
-
import random import typer def get_name(): return random.choice(["Deadpool", "Rick", "Morty", "Hiro"]) def main(name: str = typer.Argument(get_name)): typer.echo(f"Hello {name}") if __name__ == "__main__": typer.run(main)
Setting a dynamic default value. And we can even make the default value be dynamically generated by passing a function as the first function argument:
Tags
Annotators
URL
-
-
typer.tiangolo.com typer.tiangolo.com
-
def main(name: Optional[str] = typer.Argument(None)):
How to define an optional parameter in function definition in typer
Tags
Annotators
URL
-