@@ -78,25 +78,25 @@ them as keyword arguments.
7878
7979The decorator converts Python type annotations into ` add_argument() ` calls:
8080
81- | Type annotation | Generated argparse setting |
82- | -------------------------------------------------------- | ---------------------------------------------------------- |
83- | ` str ` | default (no ` type= ` needed) |
84- | ` int ` , ` float ` | ` type=int ` or ` type=float ` |
85- | ` bool ` with a default | boolean optional flag via ` BooleanOptionalAction ` |
86- | positional ` bool ` | parsed from ` true/false ` , ` yes/no ` , ` on/off ` , ` 1/0 ` |
87- | ` Path ` | ` type=Path ` |
88- | ` Enum ` subclass | ` type=converter ` , ` choices ` from member values |
89- | ` decimal.Decimal ` | ` type=decimal.Decimal ` |
90- | ` Literal[...] ` | ` type=literal-converter ` , ` choices ` from values |
91- | ` Collection[T] ` / ` list[T] ` / ` set[T] ` / ` tuple[T, ...] ` | ` nargs='+' ` (or ` '*' ` if it has a default or is ` \| None ` ) |
92- | ` tuple[T, T] ` | fixed ` nargs=N ` with ` type=T ` |
93- | ` T \| None ` (no default) | positional with ` nargs='?' ` (accepts 0-or-1 tokens) |
94- | ` T \| None = None ` | ` --flag ` option with ` default=None ` |
81+ | Type annotation | Generated argparse setting |
82+ | -------------------------------------- | ---------------------------------------------------------- |
83+ | ` str ` | default (no ` type= ` needed) |
84+ | ` int ` , ` float ` | ` type=int ` or ` type=float ` |
85+ | ` bool ` with a default | boolean optional flag via ` BooleanOptionalAction ` |
86+ | positional ` bool ` | parsed from ` true/false ` , ` yes/no ` , ` on/off ` , ` 1/0 ` |
87+ | ` Path ` | ` type=Path ` |
88+ | ` Enum ` subclass | ` type=converter ` , ` choices ` from member values |
89+ | ` decimal.Decimal ` | ` type=decimal.Decimal ` |
90+ | ` Literal[...] ` | ` type=literal-converter ` , ` choices ` from values |
91+ | ` list[T] ` / ` set[T] ` / ` tuple[T, ...] ` | ` nargs='+' ` (or ` '*' ` if it has a default or is ` \| None ` ) |
92+ | ` tuple[T, T] ` | fixed ` nargs=N ` with ` type=T ` |
93+ | ` T \| None ` (no default) | positional with ` nargs='?' ` (accepts 0-or-1 tokens) |
94+ | ` T \| None = None ` | ` --flag ` option with ` default=None ` |
9595
9696When collection types are used with ` @with_annotated ` , parsed values are passed to the command
9797function as:
9898
99- - ` list[T] ` and ` Collection[T] ` as ` list `
99+ - ` list[T] ` as ` list `
100100- ` set[T] ` as ` set `
101101- ` tuple[T, ...] ` as ` tuple `
102102
0 commit comments