##// END OF EJS Templates
alias: provide "unknowncmd" flag to tell help to look for disabled command...
Yuya Nishihara -
r22161:06362842 default
parent child Browse files
Show More
@@ -364,6 +364,7 b' class cmdalias(object):'
364 self.norepo = True
364 self.norepo = True
365 self.optionalrepo = False
365 self.optionalrepo = False
366 self.badalias = None
366 self.badalias = None
367 self.unknowncmd = False
367
368
368 try:
369 try:
369 aliases, entry = cmdutil.findcmd(self.name, cmdtable)
370 aliases, entry = cmdutil.findcmd(self.name, cmdtable)
@@ -433,16 +434,9 b' class cmdalias(object):'
433 self.__doc__ = self.fn.__doc__
434 self.__doc__ = self.fn.__doc__
434
435
435 except error.UnknownCommand:
436 except error.UnknownCommand:
436 def fn(ui, *args):
437 try:
438 # check if the command is in a disabled extension
439 commands.help_(ui, cmd, unknowncmd=True)
440 except error.UnknownCommand:
441 pass
442 return -1
443 self.fn = fn
444 self.badalias = (_("alias '%s' resolves to unknown command '%s'")
437 self.badalias = (_("alias '%s' resolves to unknown command '%s'")
445 % (self.name, cmd))
438 % (self.name, cmd))
439 self.unknowncmd = True
446 except error.AmbiguousCommand:
440 except error.AmbiguousCommand:
447 self.badalias = (_("alias '%s' resolves to ambiguous command '%s'")
441 self.badalias = (_("alias '%s' resolves to ambiguous command '%s'")
448 % (self.name, cmd))
442 % (self.name, cmd))
@@ -450,8 +444,12 b' class cmdalias(object):'
450 def __call__(self, ui, *args, **opts):
444 def __call__(self, ui, *args, **opts):
451 if self.badalias:
445 if self.badalias:
452 ui.warn(self.badalias + '\n')
446 ui.warn(self.badalias + '\n')
453 if self.fn:
447 if self.unknowncmd:
454 return self.fn(ui, *args, **opts)
448 try:
449 # check if the command is in a disabled extension
450 commands.help_(ui, self.cmdname, unknowncmd=True)
451 except error.UnknownCommand:
452 pass
455 return -1
453 return -1
456 if self.shadows:
454 if self.shadows:
457 ui.debug("alias '%s' shadows command '%s'\n" %
455 ui.debug("alias '%s' shadows command '%s'\n" %
General Comments 0
You need to be logged in to leave comments. Login now