📝 Refactor docs with internal links
This commit is contained in:
parent
62fd577b3d
commit
2af83b0be5
11 changed files with 28 additions and 18 deletions
|
@ -26,7 +26,7 @@
|
|||
|
||||
Typer is library to build <abbr title="command line interface, programs executed from a terminal">CLI</abbr> applications that users will love using and developers will love creating. Based on Python 3.6+ type hints.
|
||||
|
||||
**Typer** is <a href="https://fastapi.tiangolo.com" target="_blank">FastAPI</a>'s little sibling. And it's intended to be the FastAPI of CLIs.
|
||||
**Typer** is <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a>'s little sibling. And it's intended to be the FastAPI of CLIs.
|
||||
|
||||
The key features are:
|
||||
|
||||
|
@ -243,7 +243,7 @@ And similarly for **files**, **paths**, **enums** (choices), etc. And there are
|
|||
|
||||
**Your users get**: automatic **`--help`**, (optional) **autocompletion** in their terminal (Bash, Zsh, Fish, PowerShell).
|
||||
|
||||
For a more complete example including more features, see the <a href="https://typer.tiangolo.com/tutorial/intro/">Tutorial - User Guide</a>.
|
||||
For a more complete example including more features, see the <a href="https://typer.tiangolo.com/tutorial/">Tutorial - User Guide</a>.
|
||||
|
||||
## Optional Dependencies
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
First, you might want to see the basic ways to <a href="https://typer.tiangolo.com/help-typer/" target="_blank">help Typer and get help</a>.
|
||||
First, you might want to see the basic ways to [help Typer and get help](help-typer.md){.internal-link target=_blank}.
|
||||
|
||||
Coming soon...
|
||||
|
||||
|
|
|
@ -9,5 +9,15 @@
|
|||
}
|
||||
|
||||
a.external-link::after {
|
||||
content: " [↪]";
|
||||
/* \00A0 is a non-breaking space
|
||||
to make the mark be on the same line as the link
|
||||
*/
|
||||
content: "\00A0[↪]";
|
||||
}
|
||||
|
||||
a.internal-link::after {
|
||||
/* \00A0 is a non-breaking space
|
||||
to make the mark be on the same line as the link
|
||||
*/
|
||||
content: "\00A0↪";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
## Design based on **FastAPI**
|
||||
|
||||
**Typer** is <a href="https://fastapi.tiangolo.com" target="_blank">FastAPI</a>'s little sibling.
|
||||
**Typer** is <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a>'s little sibling.
|
||||
|
||||
It follows the same design and ideas. If you know FastAPI, you already know **Typer**... more or less.
|
||||
|
||||
|
@ -8,9 +8,9 @@ It follows the same design and ideas. If you know FastAPI, you already know **Ty
|
|||
|
||||
It's all based on standard **Python 3.6 type** declarations. No new syntax to learn. Just standard modern Python.
|
||||
|
||||
If you need a 2 minute refresher of how to use Python types (even if you don't use FastAPI or Typer), check the FastAPI tutorial section: <a href="https://fastapi.tiangolo.com/python-types/" target="_blank">Python types intro</a>.
|
||||
If you need a 2 minute refresher of how to use Python types (even if you don't use FastAPI or Typer), check the FastAPI tutorial section: <a href="https://fastapi.tiangolo.com/python-types/" class="external-link" target="_blank">Python types intro</a>.
|
||||
|
||||
You will also see a 20 seconds refresher on the section [Tutorial - User Guide: First Steps](tutorial/first-steps.md).
|
||||
You will also see a 20 seconds refresher on the section [Tutorial - User Guide: First Steps](tutorial/first-steps.md){.internal-link target=_blank}.
|
||||
|
||||
## Editor support
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
Typer is library to build <abbr title="command line interface, programs executed from a terminal">CLI</abbr> applications that users will love using and developers will love creating. Based on Python 3.6+ type hints.
|
||||
|
||||
**Typer** is <a href="https://fastapi.tiangolo.com" target="_blank">FastAPI</a>'s little sibling. And it's intended to be the FastAPI of CLIs.
|
||||
**Typer** is <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a>'s little sibling. And it's intended to be the FastAPI of CLIs.
|
||||
|
||||
The key features are:
|
||||
|
||||
|
@ -243,7 +243,7 @@ And similarly for **files**, **paths**, **enums** (choices), etc. And there are
|
|||
|
||||
**Your users get**: automatic **`--help`**, (optional) **autocompletion** in their terminal (Bash, Zsh, Fish, PowerShell).
|
||||
|
||||
For a more complete example including more features, see the <a href="https://typer.tiangolo.com/tutorial/intro/">Tutorial - User Guide</a>.
|
||||
For a more complete example including more features, see the <a href="https://typer.tiangolo.com/tutorial/">Tutorial - User Guide</a>.
|
||||
|
||||
## Optional Dependencies
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ __init__.py test_tutorial
|
|||
|
||||
### An alternative *CLI argument* declaration
|
||||
|
||||
In the <a href="https://typer.tiangolo.com/tutorial/first-steps/#add-a-cli-argument" class="external-link" target="_blank">First Steps</a> you saw how to add a *CLI argument*:
|
||||
In the [First Steps](first-steps.md#add-a-cli-argument){.internal-link target=_blank} you saw how to add a *CLI argument*:
|
||||
|
||||
```Python hl_lines="4"
|
||||
{!./src/first_steps/tutorial002.py!}
|
||||
|
@ -191,7 +191,7 @@ For that reason, Typer (actually Click underneath) doesn't attempt to automatica
|
|||
|
||||
And 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>.
|
||||
|
||||
Check the last example from the <a href="https://typer.tiangolo.com/tutorial/first-steps/#document-your-cli-app" class="external-link" target="_blank">First Steps</a>:
|
||||
Check the last example from the [First Steps](first-steps.md#document-your-cli-app){.internal-link target=_blank}:
|
||||
|
||||
```Python hl_lines="5 6 7 8 9"
|
||||
{!./src/first_steps/tutorial006.py!}
|
||||
|
|
|
@ -389,14 +389,14 @@ are called "Python function parameters" or "Python function arguments".
|
|||
|
||||
One refers to the variable name in a function *declaration*. Like:
|
||||
|
||||
```Python
|
||||
```
|
||||
def bring_person(name: str, lastname: str = ""):
|
||||
pass
|
||||
```
|
||||
|
||||
The other refers to the value passed when *calling* a function. Like:
|
||||
|
||||
```Python
|
||||
```
|
||||
person = bring_person("Camila", lastname="Gutiérrez")
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
## Python types
|
||||
|
||||
If you need a refreshed about how to use Python type hints, check the first part of <a href="https://fastapi.tiangolo.com/python-types/" target="_blank">FastAPI's Python types intro</a>.
|
||||
If you need a refreshed about how to use Python type hints, check the first part of <a href="https://fastapi.tiangolo.com/python-types/" class="external-link" target="_blank">FastAPI's Python types intro</a>.
|
||||
|
||||
You can also check the <a href="https://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html" class="external-link" target="_blank">mypy cheat sheet</a>.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
When you need to ask the user for info interactively you should normally use <a href="https://typer.tiangolo.com/tutorial/options/prompt/" class="external-link" target="_blank">*CLI Option*s with Prompt</a>, because they allow using the CLI program in a non-interactive way (for example, a Bash script could use it).
|
||||
When you need to ask the user for info interactively you should normally use [*CLI Option*s with Prompt](options/prompt.md){.internal-link target=_blank}, because they allow using the CLI program in a non-interactive way (for example, a Bash script could use it).
|
||||
|
||||
But if you absolutely need to ask for interactive information without using a *CLI option*, you can use `typer.prompt()`:
|
||||
|
||||
|
@ -22,7 +22,7 @@ Hello Camila
|
|||
|
||||
## Confirm
|
||||
|
||||
There's also an alternative to ask for confirmation. Again, if possible, you should use a <a href="https://typer.tiangolo.com/tutorial/options/prompt/" class="external-link" target="_blank">*CLI Option* with a confirmation prompt</a>:
|
||||
There's also an alternative to ask for confirmation. Again, if possible, you should use a [*CLI Option* with a confirmation prompt](options/prompt.md){.internal-link target=_blank}:
|
||||
|
||||
```Python hl_lines="5"
|
||||
{!./src/prompt/tutorial002.py!}
|
||||
|
|
|
@ -51,7 +51,7 @@ Creating user: Camila
|
|||
|
||||
If a callback was added when creating the `typer.Typer()` app, it's possible to override it with a new one using `@app.callback()`.
|
||||
|
||||
This is the same information you saw on the section about <a href="https://typer.tiangolo.com/tutorial/commands/callback/" class="external-link" target="_blank">Commands - Typer Callback</a>, and it applies the same for sub-Typer apps:
|
||||
This is the same information you saw on the section about [Commands - Typer Callback](../commands/callback.md){.internal-link target=_blank}, and it applies the same for sub-Typer apps:
|
||||
|
||||
```Python hl_lines="6 7 10 14 15 16"
|
||||
{!./src/subcommands/callback_override/tutorial003.py!}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
You read before how to create a program with <a href="https://typer.tiangolo.com/tutorial/commands/" class="external-link" target="_blank">Commands</a>.
|
||||
You read before how to create a program with [Commands](../commands/index.md){.internal-link target=_blank}.
|
||||
|
||||
Now we'll see how to create a *CLI program* with commands that have their own subcommands. Also known as command groups.
|
||||
|
||||
|
|
Loading…
Reference in a new issue