mercurial/help.py
changeset 8938 9b8c9266c59d
parent 8933 6176ca261f86
child 9023 cd92a6968f70
equal deleted inserted replaced
8937:ea798e03a32e 8938:9b8c9266c59d
     3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
     3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2, incorporated herein by reference.
     6 # GNU General Public License version 2, incorporated herein by reference.
     7 
     7 
     8 import textwrap
       
     9 from i18n import _
     8 from i18n import _
    10 import extensions
     9 import extensions, util
    11 
    10 
    12 
    11 
    13 def moduledoc(file):
    12 def moduledoc(file):
    14     '''return the top-level python documentation for the given file
    13     '''return the top-level python documentation for the given file
    15 
    14 
    44     '''return a text listing of the given extensions'''
    43     '''return a text listing of the given extensions'''
    45     if not exts:
    44     if not exts:
    46         return ''
    45         return ''
    47     result = '\n%s\n\n' % header
    46     result = '\n%s\n\n' % header
    48     for name, desc in sorted(exts.iteritems()):
    47     for name, desc in sorted(exts.iteritems()):
    49         # wrap desc at 70 characters, just like the main help texts
    48         desc = util.wrap(desc, maxlength + 4)
    50         desc = textwrap.wrap(desc, width=78 - maxlength - 4)
    49         result += ' %s   %s\n' % (name.ljust(maxlength), desc)
    51         pad = '\n' + ' ' * (maxlength + 4)
       
    52         result += ' %s   %s\n' % (name.ljust(maxlength),
       
    53                                   pad.join(desc))
       
    54     return result
    50     return result
    55 
    51 
    56 def extshelp():
    52 def extshelp():
    57     doc = _(r'''
    53     doc = _(r'''
    58     Mercurial has the ability to add new features through the use of
    54     Mercurial has the ability to add new features through the use of