##// END OF EJS Templates
help: format extension lists using RST...
Olav Reinert -
r16852:af69b2b6 default
parent child Browse files
Show More
@@ -3218,9 +3218,9 b' def help_(ui, name=None, unknowncmd=Fals'
3218 hangindent=' ' * (m + 4))))
3218 hangindent=' ' * (m + 4))))
3219
3219
3220 if not name:
3220 if not name:
3221 text = help.listexts(_('enabled extensions:'), extensions.enabled())
3221 rst = help.listexts(_('enabled extensions:'), extensions.enabled())
3222 if text:
3222 if rst:
3223 ui.write("\n%s" % minirst.format(text, textwidth))
3223 ui.write("\n%s" % minirst.format('\n'.join(rst), textwidth))
3224
3224
3225 ui.write(_("\nadditional help topics:\n\n"))
3225 ui.write(_("\nadditional help topics:\n\n"))
3226 topics = []
3226 topics = []
@@ -3318,12 +3318,12 b' def help_(ui, name=None, unknowncmd=Fals'
3318 ui.configbool('ui', 'strict'))
3318 ui.configbool('ui', 'strict'))
3319 doc = gettext(mod.__doc__).splitlines()[0]
3319 doc = gettext(mod.__doc__).splitlines()[0]
3320
3320
3321 msg = help.listexts(_("'%s' is provided by the following "
3321 rst = help.listexts(_("'%s' is provided by the following "
3322 "extension:") % cmd, {ext: doc}, indent=4)
3322 "extension:") % cmd, {ext: doc}, indent=4)
3323 ui.write(minirst.format(msg, textwidth))
3323 rst.append('\n')
3324 ui.write('\n')
3324 rst.append(_('use "hg help extensions" for information on enabling '
3325 ui.write(_('use "hg help extensions" for information on enabling '
3326 'extensions\n'))
3325 'extensions\n'))
3326 ui.write(minirst.format(''.join(rst), textwidth))
3327
3327
3328 kw = opts.get('keyword')
3328 kw = opts.get('keyword')
3329 if kw:
3329 if kw:
@@ -12,19 +12,18 b' import encoding, util, minirst'
12
12
13 def listexts(header, exts, indent=1):
13 def listexts(header, exts, indent=1):
14 '''return a text listing of the given extensions'''
14 '''return a text listing of the given extensions'''
15 if not exts:
15 rst = []
16 return ''
16 if exts:
17 maxlength = max(len(e) for e in exts)
17 rst.append('\n%s\n\n' % header)
18 result = '\n%s\n\n' % header
18 for name, desc in sorted(exts.iteritems()):
19 for name, desc in sorted(exts.iteritems()):
19 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
20 result += '%s%-*s %s\n' % (' ' * indent, maxlength + 2,
20 return rst
21 ':%s:' % name, desc)
22 return result
23
21
24 def extshelp():
22 def extshelp():
25 doc = loaddoc('extensions')()
23 rst = loaddoc('extensions')().splitlines(True)
26 doc += listexts(_('enabled extensions:'), extensions.enabled())
24 rst.extend(listexts(_('enabled extensions:'), extensions.enabled()))
27 doc += listexts(_('disabled extensions:'), extensions.disabled())
25 rst.extend(listexts(_('disabled extensions:'), extensions.disabled()))
26 doc = ''.join(rst)
28 return doc
27 return doc
29
28
30 def optrst(options, verbose):
29 def optrst(options, verbose):
General Comments 0
You need to be logged in to leave comments. Login now