Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/help.py @ 8889:9be824115ee8
help: wrap extension descriptions
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Mon, 22 Jun 2009 00:02:31 +0200 |
parents | a3a936a2fe46 |
children | ef59f4634a15 |
comparison
equal
deleted
inserted
replaced
8888:bd93d0e0d317 | 8889:9be824115ee8 |
---|---|
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 | |
8 from i18n import _ | 9 from i18n import _ |
9 import extensions | 10 import extensions |
10 | 11 |
11 | 12 |
12 def moduledoc(file): | 13 def moduledoc(file): |
43 '''return a text listing of the given extensions''' | 44 '''return a text listing of the given extensions''' |
44 if not exts: | 45 if not exts: |
45 return '' | 46 return '' |
46 result = '\n%s\n\n' % header | 47 result = '\n%s\n\n' % header |
47 for name, desc in sorted(exts.iteritems()): | 48 for name, desc in sorted(exts.iteritems()): |
48 result += ' %s %s\n' % (name.ljust(maxlength), desc) | 49 # wrap desc at 70 characters, just like the main help texts |
50 desc = textwrap.wrap(desc, width=70 - maxlength - 4) | |
51 pad = '\n' + ' ' * (maxlength + 4) | |
52 result += ' %s %s\n' % (name.ljust(maxlength), | |
53 pad.join(desc)) | |
49 return result | 54 return result |
50 | 55 |
51 def extshelp(): | 56 def extshelp(): |
52 doc = _(r''' | 57 doc = _(r''' |
53 Mercurial has the ability to add new features through the use of | 58 Mercurial has the ability to add new features through the use of |