typed-argparse
typed-argparse copied to clipboard
💡 write type-safe and elegant CLIs with a clear separation of concerns.
Fixes #71 Automatically detects [NamedTuples](https://docs.python.org/3/library/typing.html#typing.NamedTuple) and uses a custom [action](https://docs.python.org/3/library/argparse.html#argparse.Action) to parse the values. Works with `nargs` by modifying the actions `nargs` to be `nargs * len(namedtuple._fields)` (if `nargs` is...
I want to have an argument that takes multiple values but of different types. This seems only possible with the [action](https://docs.python.org/3/library/argparse.html#action) argument which isn't supported by typed-argparse. In my fork...
The signature of the method `Parser.parse_args()` types the argument `raw_args: List[str]`: https://github.com/typed-argparse/typed-argparse/blob/d5b596a7df6cce0b763894053ebec602f44951ca/typed_argparse/parser.py#L175 This is too strict because `raw_args` is only being used as `args` argument for `argparse.ArgumentParser.parse_args()` which is typed...
This patch moves the formatting of default values into a new `FormatterClass` that is then set as the default for `Parser`. This was originally motivated by the observation that `help=SUPPRESS`...
It would be handy if `run()` would return the result of the selected binding. Currently it always returns None. This would for example allow sub-commands to return an exit code...
Attempt to support #58
The following code demonstrate a possible pitfalls with conflicting type information between the `common_args` of a parser group and the particular arguments of one of its sub-parsers: ```py import typed_argparse...
Hi, I've been looking into this project and it looks really great - nearly exactly what we need :) . There are however a few thing I need to ask...