Treat "need 1, got 0" as a special case, and change the message to
"missing required parameter <x>". Also, when failing for that reason,
print the command concise description and its helptext.
Fixes: #6384
Signed-off-by: Dan Mick <dan.mick@inktank.com>
# wanted n, got too few
if partial:
return d
+ # special-case the "0 expected 1" case
+ if desc.numseen == 0 and desc.n == 1:
+ raise ArgumentNumber(
+ 'missing required parameter {0}'.format(desc)
+ )
raise ArgumentNumber(
'saw {0} of {1}, expected {2}'.\
format(desc.numseen, desc, desc.n)
# Stop now, because we have the right command but
# some other input is invalid
print >> sys.stderr, "Invalid command: ", str(e)
+ print >> sys.stderr, concise_sig(sig), ': ', cmd['help']
return {}
if found:
break