David Steele <dste...@gmail.com> added the comment:

I've submitted FlexiHelpFormatter as PR22129.

This adds the FlexiHelpFormatter class to argparse.

It supports wrapping text, while preserving paragraphs. Bullet lists are 
supported.

There are a number of differences, relative to the latest patch in the issue 
report:

 - single line feeds in a paragraph are allowed
 - the code is refactored to avoid duplication
 - test failure fixes (mostly whitespace)
 - Tests and documentation are included.


   >>> parser = argparse.ArgumentParser(
   ...     prog='PROG',
   ...     formatter_class=argparse.FlexiHelpFormatter,
   ...     description="""
   ...         The FlexiHelpFormatter will wrap text within paragraphs
   ...         when required to in order to make the text fit.
   ...
   ...         Paragraphs are preserved.
   ...
   ...         It also supports bulleted lists in a number of formats:
   ...           * stars
   ...           1. numbers
   ...           - ... and so on
   ...         """)
   >>> parser.add_argument(
   ...     "argument",
   ...     help="""
   ...         Argument help text also supports flexible formatting,
   ...         with word wrap:
   ...             * See?
   ...         """)
   >>> parser.print_help()
   usage: PROG [-h] option

   The FlexiHelpFormatter will wrap text within paragraphs when required to in
   order to make the text fit.

   Paragraphs are preserved.

   It also supports bulleted lists in a number of formats:
     * stars
     1. numbers
     - ... and so on

   positional arguments:
     argument    Argument help text also supports flexible formatting, with word
                 wrap:
                     * See?

   optional arguments:
     -h, --help  show this help message and exit

----------

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

Reply via email to