##// END OF EJS Templates
help: use cmdutil.parsealiases() to resolve command name...
Yuya Nishihara -
r36264:4174970c default
parent child Browse files
Show More
@@ -150,7 +150,7 b' def topicmatch(ui, commands, kw):'
150 doclines = docs.splitlines()
150 doclines = docs.splitlines()
151 if doclines:
151 if doclines:
152 summary = doclines[0]
152 summary = doclines[0]
153 cmdname = cmd.partition('|')[0].lstrip('^')
153 cmdname = cmdutil.parsealiases(cmd)[0]
154 if filtercmd(ui, cmdname, kw, docs):
154 if filtercmd(ui, cmdname, kw, docs):
155 continue
155 continue
156 results['commands'].append((cmdname, summary))
156 results['commands'].append((cmdname, summary))
@@ -170,7 +170,7 b' def topicmatch(ui, commands, kw):'
170 continue
170 continue
171 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
171 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
172 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
172 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
173 cmdname = cmd.partition('|')[0].lstrip('^')
173 cmdname = cmdutil.parsealiases(cmd)[0]
174 cmddoc = pycompat.getdoc(entry[0])
174 cmddoc = pycompat.getdoc(entry[0])
175 if cmddoc:
175 if cmddoc:
176 cmddoc = gettext(cmddoc).splitlines()[0]
176 cmddoc = gettext(cmddoc).splitlines()[0]
@@ -328,7 +328,7 b' def help_(ui, commands, name, unknowncmd'
328 # py3k fix: except vars can't be used outside the scope of the
328 # py3k fix: except vars can't be used outside the scope of the
329 # except block, nor can be used inside a lambda. python issue4617
329 # except block, nor can be used inside a lambda. python issue4617
330 prefix = inst.args[0]
330 prefix = inst.args[0]
331 select = lambda c: c.lstrip('^').startswith(prefix)
331 select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix)
332 rst = helplist(select)
332 rst = helplist(select)
333 return rst
333 return rst
334
334
@@ -419,15 +419,18 b' def help_(ui, commands, name, unknowncmd'
419 h = {}
419 h = {}
420 cmds = {}
420 cmds = {}
421 for c, e in commands.table.iteritems():
421 for c, e in commands.table.iteritems():
422 f = c.partition("|")[0]
422 fs = cmdutil.parsealiases(c)
423 if select and not select(f):
423 f = fs[0]
424 p = ''
425 if c.startswith("^"):
426 p = '^'
427 if select and not select(p + f):
424 continue
428 continue
425 if (not select and name != 'shortlist' and
429 if (not select and name != 'shortlist' and
426 e[0].__module__ != commands.__name__):
430 e[0].__module__ != commands.__name__):
427 continue
431 continue
428 if name == "shortlist" and not f.startswith("^"):
432 if name == "shortlist" and not p:
429 continue
433 continue
430 f = f.lstrip("^")
431 doc = pycompat.getdoc(e[0])
434 doc = pycompat.getdoc(e[0])
432 if filtercmd(ui, f, name, doc):
435 if filtercmd(ui, f, name, doc):
433 continue
436 continue
@@ -435,7 +438,7 b' def help_(ui, commands, name, unknowncmd'
435 if not doc:
438 if not doc:
436 doc = _("(no help text available)")
439 doc = _("(no help text available)")
437 h[f] = doc.splitlines()[0].rstrip()
440 h[f] = doc.splitlines()[0].rstrip()
438 cmds[f] = c.lstrip("^")
441 cmds[f] = '|'.join(fs)
439
442
440 rst = []
443 rst = []
441 if not h:
444 if not h:
General Comments 0
You need to be logged in to leave comments. Login now