Message186695
This patch addresses both issues raised here:
- throw an error when the subparser argument is missing
- allow the subparser argument to be optional
argparse.py:
_SubParsersAction -
add 'required=True' keyword.
name(self) method - creates a name of the form {cmd1,cmd2} for error messages.
_get_action_name() - try action.name() if it can't get a name from option_strings, dest or metavar. Still can return None.
2 error cases do a join on a list of action_names. If a name is None, this will choke. Add a ['%s'%x for x in list] guard.
test_argparse.py:
add cases to the subparser block to test the 'required' keyword, and to test the error message changes.
argparse.rst:
add a summary of the add_subparsers() arguments. |
|
Date |
User |
Action |
Args |
2013-04-13 06:24:33 | 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-13 06:24:33 | paul.j3 | set | messageid: <1365834273.12.0.564979203879.issue9253@psf.upfronthosting.co.za> |
2013-04-13 06:24:33 | paul.j3 | link | issue9253 messages |
2013-04-13 06:24:32 | paul.j3 | create | |
|