comparison mercurial/help.py @ 10364:de1e7099d100

dispatch: provide help for disabled extensions and commands Before a command is declared unknown, each extension in hgext is searched, starting with hgext.<cmdname>. If there's a matching command, a help message suggests the appropriate extension and how to enable it. Every extension could potentially be imported, but for cases like rebase, relink, etc. only one extension is imported. For the case of "hg help disabledext", if the extension is in hgext, the extension description is read and a similar help suggestion is printed. No extension import occurs.
author Brodie Rao <me+hg@dackz.net>
date Sun, 07 Feb 2010 14:01:43 +0100
parents 08a0f04b56bd
children 61c52fedbd45
comparison
equal deleted inserted replaced
10363:c07974215b3d 10364:de1e7099d100
40 else: 40 else:
41 return None 41 return None
42 42
43 return ''.join(result) 43 return ''.join(result)
44 44
45 def listexts(header, exts, maxlength): 45 def listexts(header, exts, maxlength, indent=1):
46 '''return a text listing of the given extensions''' 46 '''return a text listing of the given extensions'''
47 if not exts: 47 if not exts:
48 return '' 48 return ''
49 result = '\n%s\n\n' % header 49 result = '\n%s\n\n' % header
50 for name, desc in sorted(exts.iteritems()): 50 for name, desc in sorted(exts.iteritems()):
51 result += ' %-*s %s\n' % (maxlength + 2, ':%s:' % name, desc) 51 result += '%s%-*s %s\n' % (' ' * indent, maxlength + 2,
52 ':%s:' % name, desc)
52 return result 53 return result
53 54
54 def extshelp(): 55 def extshelp():
55 doc = loaddoc('extensions')() 56 doc = loaddoc('extensions')()
56 57