Skip to content
Myr

:memo: Fix wording to avoid confusion between CLI program, command, subcommand

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sebastián Ramírez · committed by Sebastián Ramírez · parent b883516 · Browse files · 4 files+7 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+7 added−7 removed

  • other:+7 added−7 removed

4 files+7 added−7 removed

modified:docs/tutorial/arguments.md+4 added-4 removed
11 unmodified lines
12But you can change that.1314In fact, it's very common to have **optional** *CLI arguments*, it's way more common than having **required** *CLI options*.1516As an example of how it could be useful, let's see how the `ls` command works.16As an example of how it could be useful, let's see how the `ls` CLI program works.1718<div class="termy">1920```console
136 unmodified lines
157158</div>159160!!! tip161 Notice that "`Camila`" here is an optional *CLI argument*, not a *CLI option*, because we didn't use something like "`--name Camila`", we just passed "`Camila`" directly to the program/command.161 Notice that "`Camila`" here is an optional *CLI argument*, not a *CLI option*, because we didn't use something like "`--name Camila`", we just passed "`Camila`" directly to the program.162163## An optional *CLI argument* with a default164165We can also make a *CLI argument* have a default value other than `None`:
27 unmodified lines
193They are normally required and, when present, they are normally the main subject of whatever the command is doing.194195For that reason, Typer (actually Click underneath) doesn't attempt to automatically document *CLI arguments*.196197And you should document them as part of the command documentation, normally in a <abbr title="a multi-line string as the first expression inside a function (not assigned to any variable) used for documentation">docstring</abbr>.197And you should document them as part of the CLI app documentation, normally in a <abbr title="a multi-line string as the first expression inside a function (not assigned to any variable) used for documentation">docstring</abbr>.198199Check the last example from the <a href="https://typer.tiangolo.com/tutorial/first-steps/#document-your-cli-app" target="_blank">First Steps</a>:200201```Python hl_lines="5 6 7 8 9"202{!./src/first_steps/tutorial006.py!}203```204205Here the *CLI argument* `NAME` is documented as part of the command help text.205Here the *CLI argument* `NAME` is documented as part of the help text.206207You should document your *CLI arguments* the same way.208209## Other uses
4 unmodified lines
modified:docs/features.md+1 added-1 removed
modified:docs/index.md+1 added-1 removed
29 unmodified lines
3031The key features are:3233* **Intuitive to write**: Great editor support. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> everywhere. Less time debugging. Designed to be easy to use and learn. Less time reading docs.34* **Easy to use**: It's easy to use for the final users. Automatic help commands, and (optional) automatic completion for all shells.34* **Easy to use**: It's easy to use for the final users. Automatic help, and (optional) automatic completion for all shells.35* **Short**: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs.36* **Start simple**: The simplest example adds only 2 lines of code to your app: **1 import, 1 function call**.37* **Grow large**: Grow in complexity as much as you want, create arbitrarily complex trees of commands and groups subcommands, with options and arguments.38
236 unmodified lines
modified:README.md+1 added-1 removed
29 unmodified lines
3031The key features are:3233* **Intuitive to write**: Great editor support. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> everywhere. Less time debugging. Designed to be easy to use and learn. Less time reading docs.34* **Easy to use**: It's easy to use for the final users. Automatic help commands, and (optional) automatic completion for all shells.34* **Easy to use**: It's easy to use for the final users. Automatic help, and (optional) automatic completion for all shells.35* **Short**: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs.36* **Start simple**: The simplest example adds only 2 lines of code to your app: **1 import, 1 function call**.37* **Grow large**: Grow in complexity as much as you want, create arbitrarily complex trees of commands and groups subcommands, with options and arguments.38
236 unmodified lines