Open treyhunner opened 8 years ago
What you are saying is that it would be nice to have finer specification of nargs
argument to argparse's add_argument
. Maybe it could be done with something like @begin.params(numbers={'nargs':'+'})
. Maybe having a lot of chained decorators is not so cool so @begin.convert
could be included in @begin.params(numbers={'type':float, 'nargs':'+'})
.
It would be convenient if I can specify that given
*args
are required.Here I'm able to convert all captured
*numbers
tofloat
, but I cannot find a way to requirenumbers
to be non-empty.I'm using a
SystemExit
exception as a workaround, but ifbegins
printed out an error and the usage statement for me, that would be much more convenient.I often require at least one positional argument when using
*args
so this is a common use case for me.