This is already a simple CLI program to manage reigns:
fast βπ¬ Check the helppython reigns.py --help Usage: reigns.py [OPTIONS] COMMAND [ARGS]...
Options: --install-completion Install completion for the current shell. --show-completion Show completion for the current shell, to copy it or customize the installation. --help Show this message and exit.
fast βπ¬ Check the helppython towns.py --help Usage: towns.py [OPTIONS] COMMAND [ARGS]...
Options: --install-completion Install completion for the current shell. --show-completion Show completion for the current shell, to copy it or customize the installation. --help Show this message and exit.
Commands: burn found
π¬ Try itpython towns.py found "New Asgard" Founding town: New Asgard
And now we have a single CLI program with a command (or command group) reigns that has its own commands. And another command towns with its own subcommands.
Check it:
fast βπ¬ Check the helppython lands.py --help Usage: lands.py [OPTIONS] COMMAND [ARGS]...
Options: --install-completion Install completion for the current shell. --show-completion Show completion for the current shell, to copy it or customize the installation. --help Show this message and exit.
Commands: reigns towns
π¬ We still have the help for reignspython lands.py reigns --help Usage: lands.py reigns [OPTIONS] COMMAND [ARGS]...
Options: --help Show this message and exit.
Commands: conquer destroy
π¬ And the help for townspython lands.py towns --help Usage: lands.py towns [OPTIONS] COMMAND [ARGS]...
And now we have everything in a single CLI program:
fast βπ¬ Check the main helppython main.py --help Usage: main.py [OPTIONS] COMMAND [ARGS]...
Options: --install-completion Install completion for the current shell. --show-completion Show completion for the current shell, to copy it or customize the installation. --help Show this message and exit.
That's it, you can just add Typer applications one inside another as much as you want and create complex CLI programs while writing simple code.
You can probably achieve a simpler CLI program design that's easier to use than the example here. But if your requirements are complex, Typer helps you build your CLI app easily.
Tip
Auto completion helps a lot, specially with complex programs.
Check the docs about adding auto completion to your CLI apps.