Message186532
Further observations:
parser.add_subparsers() accepts a 'dest' keyword arg, but not a 'required' one. Default of 'dest' is SUPPRESS, so the name does not appear in the Namespace. Changing it to something like 'command' will produce an entry, e.g. Namespace(command=foo, ...). Is this a problem?
Assuming we have a clean way of assigning a name to 'subparsers', what should it be? 'command', '{cmd}', '{foo,bar,baz}' (like in the usage line)? This name also could be used when telling the user the subparser choice is invalid (parser._check_value).
This issue exposes a problem with '_get_action_name()'. This function gets a name from the action's option_strings, metavar or dest. If it can't get a string, it returns None.
ArgumentError pays attention to whether this action name is a string or None, and adjusts its message accordingly. But the new replacement for the 'too few arguments' error message does a ', '.join([action names]), which chokes if one of those names is None. There is a mutually_exclusive_groups test that also uses this 'join'. This bug should be fixed regardless of what is done with subparsers error messages.
So the issues are:
- making 'subparsers' a required argument
- choosing or generating an appropriate name for 'subparsers'
- passing this name to the error message (via _get_action_name?)
- correcting the handling of action names when they are unknown (None). |
|
Date |
User |
Action |
Args |
2013-04-10 21:31:10 | paul.j3 | set | recipients:
+ paul.j3, csernazs, bethard, eric.araujo, r.david.murray, zzzeek, labrat, chris.jerdonek, nvie, DasIch, elsdoerfer, G2P, Julian, dsully, seblu, bewest, bkabrda |
2013-04-10 21:31:10 | paul.j3 | set | messageid: <1365629470.32.0.811576633203.issue9253@psf.upfronthosting.co.za> |
2013-04-10 21:31:10 | paul.j3 | link | issue9253 messages |
2013-04-10 21:31:09 | paul.j3 | create | |
|