[Mailman-Developers] Click CLI branch

Mark Sapiro mark at msapiro.net
Thu Jul 20 18:11:43 EDT 2017


On 07/20/2017 02:26 PM, Mark Sapiro wrote:
> 
> The first thing I notice right away is the help text doesn't fill. E.g.,
> 
>> $ ./mailman --help
>> Usage: mailman [OPTIONS] COMMAND [ARGS]...
>>
>>   The GNU Mailman mailing list management system Copyright 1998-2017 by the
>>   Free Software Foundation, Inc. http://www.list.org
>>
>> Options:
>>   -C, --config PATH  Configuration file to use.  If not given, the environment
>>                      variable
>>                      MAILMAN_CONFIG_FILE is consulted and used if
>>                      set.  If neither are given, a
>>                      default configuration file
>>                      is loaded.
>>   --version          Show the version and exit.
>>   --help             Show this message and exit.
...


I've looked at the click docs and I see that text from docstrings is
wrapped and filled as is the text

>     """\
>     The GNU Mailman mailing list management system
>     Copyright 1998-2017 by the Free Software Foundation, Inc.
>     http://www.list.org
>     """

which wraps and fills as above, nd there is even a control to turn that
off paragraph by paragraph, but the 'help=' text for an option doesn't
seem to be handled that way.

A possible workaround is to replace things like

>     help=_("""\
>     Configuration file to use.  If not given, the environment variable
>     MAILMAN_CONFIG_FILE is consulted and used if set.  If neither are given, a
>     default configuration file is loaded."""))

with

>     help=_(
>     'Configuration file to use.  If not given, the environment variable '
>     'MAILMAN_CONFIG_FILE is consulted and used if set.  If neither are given, '
>     'a default configuration file is loaded.'))

This seems to work to produce

> Usage: mailman [OPTIONS] COMMAND [ARGS]...
> 
>   The GNU Mailman mailing list management system Copyright 1998-2017 by the
>   Free Software Foundation, Inc. http://www.list.org
> 
> Options:
>   -C, --config PATH  Configuration file to use.  If not given, the environment
>                      variable MAILMAN_CONFIG_FILE is consulted and used if
>                      set.  If neither are given, a default configuration file
>                      is loaded.
>   --version          Show the version and exit.
>   --help             Show this message and exit.
> 


-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/mailman-developers/attachments/20170720/11b945ab/attachment.sig>


More information about the Mailman-Developers mailing list