Overview
Typer 0.4, released on August 30, 2021, improves auto-completion and sub-command handling.
Main Features
Auto-completion
Typer 0.4 uses Click 8's new completion system for Bash, Zsh, and Fish.
python
import typer
app = typer.Typer()
@app.command()
def greet(name: str, formal: bool = False):
if formal:
typer.echo(f'Hello, {name}.')
else:
typer.echo(f'Hi {name}!')
if __name__ == '__main__':
app()
Sub-commands
Sub-command handling is improved with better nested group support.
python
import typer
app = typer.Typer()
users_app = typer.Typer()
app.add_typer(users_app, name='users')
@users_app.command('list')
def list_users():
typer.echo('Alice, Bob')
@users_app.command('add')
def add_user(name: str):
typer.echo(f'Added: {name}')
