##// END OF EJS Templates
commands: wrap short descriptions in 'hg help'...
Martin Geisler -
r8938:9b8c9266 default
parent child Browse files
Show More
@@ -8,7 +8,7 b''
8 8 from node import hex, nullid, nullrev, short
9 9 from lock import release
10 10 from i18n import _, gettext
11 import os, re, sys, textwrap, subprocess, difflib, time
11 import os, re, sys, subprocess, difflib, time
12 12 import hg, util, revlog, bundlerepo, extensions, copies, context, error
13 13 import patch, help, mdiff, tempfile, url, encoding
14 14 import archival, changegroup, cmdutil, sshserver, hbisect
@@ -1514,7 +1514,7 b' def help_(ui, name=None, with_version=Fa'
1514 1514 commands = cmds[f].replace("|",", ")
1515 1515 ui.write(" %s:\n %s\n"%(commands, h[f]))
1516 1516 else:
1517 ui.write(' %-*s %s\n' % (m, f, h[f]))
1517 ui.write(' %-*s %s\n' % (m, f, util.wrap(h[f], m + 4)))
1518 1518
1519 1519 if name != 'shortlist':
1520 1520 exts, maxlength = extensions.enabled()
@@ -1617,11 +1617,8 b' def help_(ui, name=None, with_version=Fa'
1617 1617 opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0])
1618 1618 for first, second in opt_output:
1619 1619 if second:
1620 # wrap descriptions at 70 characters, just like the
1621 # main help texts
1622 second = textwrap.wrap(second, width=70 - opts_len - 3)
1623 pad = '\n' + ' ' * (opts_len + 3)
1624 ui.write(" %-*s %s\n" % (opts_len, first, pad.join(second)))
1620 second = util.wrap(second, opts_len + 3)
1621 ui.write(" %-*s %s\n" % (opts_len, first, second))
1625 1622 else:
1626 1623 ui.write("%s\n" % first)
1627 1624
@@ -5,9 +5,8 b''
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2, incorporated herein by reference.
7 7
8 import textwrap
9 8 from i18n import _
10 import extensions
9 import extensions, util
11 10
12 11
13 12 def moduledoc(file):
@@ -46,11 +45,8 b' def listexts(header, exts, maxlength):'
46 45 return ''
47 46 result = '\n%s\n\n' % header
48 47 for name, desc in sorted(exts.iteritems()):
49 # wrap desc at 70 characters, just like the main help texts
50 desc = textwrap.wrap(desc, width=78 - maxlength - 4)
51 pad = '\n' + ' ' * (maxlength + 4)
52 result += ' %s %s\n' % (name.ljust(maxlength),
53 pad.join(desc))
48 desc = util.wrap(desc, maxlength + 4)
49 result += ' %s %s\n' % (name.ljust(maxlength), desc)
54 50 return result
55 51
56 52 def extshelp():
@@ -16,7 +16,7 b' hide platform-specific details from the '
16 16 from i18n import _
17 17 import error, osutil
18 18 import cStringIO, errno, re, shutil, sys, tempfile, traceback
19 import os, stat, time, calendar, random
19 import os, stat, time, calendar, random, textwrap
20 20 import imp
21 21
22 22 # Python compatibility
@@ -1242,6 +1242,10 b' def termwidth():'
1242 1242 pass
1243 1243 return 80
1244 1244
1245 def wrap(line, hangindent, width=78):
1246 padding = '\n' + ' ' * hangindent
1247 return padding.join(textwrap.wrap(line, width=width - hangindent))
1248
1245 1249 def iterlines(iterator):
1246 1250 for chunk in iterator:
1247 1251 for line in chunk.splitlines():
@@ -36,8 +36,7 b' enabled extensions:'
36 36 global options:
37 37 -R --repository repository root directory or symbolic path name
38 38 --cwd change working directory
39 -y --noninteractive do not prompt, assume 'yes' for any required
40 answers
39 -y --noninteractive do not prompt, assume 'yes' for any required answers
41 40 -q --quiet suppress output
42 41 -v --verbose enable additional output
43 42 --config set/override config option
@@ -27,10 +27,8 b' interactively select changes to commit'
27 27
28 28 options:
29 29
30 -A --addremove mark new/missing files as added/removed before
31 committing
32 --close-branch mark a branch as closed, hiding it from the branch
33 list
30 -A --addremove mark new/missing files as added/removed before committing
31 --close-branch mark a branch as closed, hiding it from the branch list
34 32 -I --include include names matching the given patterns
35 33 -X --exclude exclude names matching the given patterns
36 34 -m --message use <text> as commit message
General Comments 0
You need to be logged in to leave comments. Login now