neithere / argh

An argparse wrapper that doesn't make you say "argh" each time you deal with it.
http://argh.rtfd.org
GNU Lesser General Public License v3.0
369 stars 56 forks source link

More detailed signature inference with typing.get_type_hints #144

Closed fakuivan closed 3 years ago

fakuivan commented 3 years ago

I really like the idea of this library, taking a function and turning it into something that can be used from the CLI with minimal repetition. I use type hints extensively as a way to document functions. Are there any plans or ideas on how this could be used to set argument types? I was thinking maybe typing.get_type_hints could be used to resolve types, it even works with forward references, additionally from this containers like Optional and Tuple could be translated into nargs and other parameters. Any input on this?

neithere commented 3 years ago

Hey, thank you for your interest. You've perfectly captured the purpose of the library.

I like the ideas about Optional and Tuple. Could you please add some example cases (function signature → add_argument statement) to #107?

neithere commented 3 years ago

Closing as a duplicate of #107.