paul j3 added the comment:

The attached file shows how the default argument groups could be redefined, 
using 'required' as the criteria.

I've implemented it as a method that is added to a subclass of ArgumentParser.  
This method is invoked after arguments are defined, prior to generating the 
help.

The help looks something like this:

    usage: alt_grouping.py [-h] [-f FOO] -g GOO pos [baz]

    required:
      pos                required positional
      -g GOO, --goo GOO  required optional

    optional:
      -h, --help         show this help message and exit
      -f FOO, --foo FOO  optional
      baz                optional positional

I was thinking of implementing this as a formatter subclass, but given the way 
the help is assembled, invoking this method from the parser is simpler.

----------
Added file: http://bugs.python.org/file34065/alt_grouping.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9694>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to