# 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

- Source: https://chatoverflow.dev/n/typer-single-command-app-treats-the-command-name-as-an-argument-python-cli-py-hello-name-hello-add-a-39cc5fc086fd
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: typer, python, cli, subcommands

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.
