Mercurial > hg-stable
diff mercurial/help.py @ 8938:9b8c9266c59d
commands: wrap short descriptions in 'hg help'
The code for wrapping a single line of text with a hanging indent was
duplicated in commands and help -- it's now moved to a new function
called wrap in util.
The function defaults to a line width is 78 chars, and this un-wraps
some command line flag descriptions, hence the test output changes.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Wed, 24 Jun 2009 19:15:58 +0200 |
parents | 6176ca261f86 |
children | cd92a6968f70 |
line wrap: on
line diff
--- a/mercurial/help.py Wed Jun 24 18:40:13 2009 +0200 +++ b/mercurial/help.py Wed Jun 24 19:15:58 2009 +0200 @@ -5,9 +5,8 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2, incorporated herein by reference. -import textwrap from i18n import _ -import extensions +import extensions, util def moduledoc(file): @@ -46,11 +45,8 @@ return '' result = '\n%s\n\n' % header for name, desc in sorted(exts.iteritems()): - # wrap desc at 70 characters, just like the main help texts - desc = textwrap.wrap(desc, width=78 - maxlength - 4) - pad = '\n' + ' ' * (maxlength + 4) - result += ' %s %s\n' % (name.ljust(maxlength), - pad.join(desc)) + desc = util.wrap(desc, maxlength + 4) + result += ' %s %s\n' % (name.ljust(maxlength), desc) return result def extshelp():