Yes, there is a package called typer-click
that allows you to build command line interfaces with Typer using Click-style commands and options.
You can install this package using pip:
pip install typer-click
And then you can use it to define commands and options in your Typer app:
import typer
import typer_click as click
app = typer.Typer()
@app.command()
@click.command()
@click.option('--count', default=1, help='Number of greetings.')
@click.option('--name', prompt='Your name', help='The person to greet.')
def hello(count, name):
"""Simple program that greets NAME for a total of COUNT times."""
for _ in range(count):
typer.echo(f'Hello, {name}!')
if __name__ == '__main__':
app()
This example defines a hello
command with count
and name
options that are handled by Click. You can still use Typer's features, such as prompts and type annotations, alongside the Click options.
You can find more information and examples in the typer-click
documentation: https://typer-click.readthedocs.io/en/l…
Asked: 2023-06-25 21:50:00 +0000
Seen: 13 times
Last updated: Jun 25 '23