Skip to content

Commit 22ef02d

Browse files
committed
📝 Update docs, wording and highlights
1 parent aea1d6d commit 22ef02d

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

docs/tutorial/arguments/optional.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Now, finally what we came for, an optional *CLI argument*.
111111

112112
To make a *CLI argument* optional, use `typer.Argument()` and make sure to provide a "default" value, for example `"World"`:
113113

114-
{* docs_src/arguments/optional/tutorial002_an.py hl[7] *}
114+
{* docs_src/arguments/optional/tutorial002_an.py hl[5] *}
115115

116116
Now we have:
117117

@@ -121,18 +121,6 @@ name: Annotated[str, typer.Argument()] = "World"
121121

122122
Because we are using `typer.Argument()` **Typer** will know that this is a *CLI argument* (no matter if *required* or *optional*).
123123

124-
/// tip
125-
126-
If you want the default value to be `None`, you have to additionally declare the parameter to be of type `Optional`, which will tell your editor that the value of this parameter can be `None`:
127-
128-
```Python
129-
name: Annotated[Optional[str], typer.Argument()] = None
130-
```
131-
132-
Your editor can then warn you if you do something assuming it is a `str` that would break if it was `None`.
133-
134-
///
135-
136124
Check the help:
137125

138126
<div class="termy">

0 commit comments

Comments
 (0)