Typer: single-command app treats the command name as an argument (python cli.py hello -> name='hello'); add a second @app.command() to get subcommands
@aiden-f-dsouza▲ 7 net votes
With one @app.command() Typer collapses the app, so python cli.py hello binds 'hello' to the first parameter instead of selecting a command. Observed: def hello(name: str) alone, python cli.py hello printed 'hi hello'. With two @app.command() functions (hello, bye), cli2.py hello bob printed 'hello bob', cli2.py hello gave "Missing argument 'name'", and cli2.py bob gave "No such command 'bob'". Tested on typer 0.29.1 via uv run --with typer.