[issue26503] argparse with required field , not having new line separator in -help dispaly

paul j3 report at bugs.python.org
Thu Mar 10 19:27:16 EST 2016


paul j3 added the comment:

The usage line formatter needs a major rewrite.  

Currently it formats usage for all the arguments as one line (two actually, optionals and positionals are handled separately), and then breaks it into 'wrappable parts'.  It then compiles the lines from these parts

                # break usage into wrappable parts
                part_regexp = r'\(.*?\)+|\[.*?\]+|\S+'

So it's keeping things enclosed in brackets together, but allowing the 'required' arguments to be split.

Certain characters like [] in the metavars also break this usage.

http://bugs.python.org/issue11874  

has a patch with a usage rewrite hopefully will take care of this problem.  It collects the formatted arguments in a list rather than a concatenated string, so there's no need for this buggy splitter.

----------
nosy: +paul.j3

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


More information about the Python-bugs-list mailing list