[issue11708] argparse: suggestion for formatting optional positional args

paul j3 report at bugs.python.org
Fri Apr 25 07:25:45 CEST 2014


paul j3 added the comment:

This is a testing script for this patch.  It is not a unit test.
Example:

    p = argparse.ArgumentParser()
    p.formatter_class = argparse.ReGroupHelpFormatter
    p.add_argument('foo')
    p.add_argument('arg1',nargs='?')
    p.add_argument('arg2',nargs='?')
    a = p.add_argument('arg3',nargs='*')
    b = p.add_argument('arg4', nargs='?')
    # usage: regp [-h] foo [arg1 [arg2 [arg3 [arg3 ...] [arg4]]]]

----------
Added file: http://bugs.python.org/file35035/test_regroup.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11708>
_______________________________________


More information about the Python-bugs-list mailing list