comparison mercurial/dispatch.py @ 9876:6e8a16dd3e30

alias: improve help text for command aliases Displays the line "alias for: hg ..." with the original command including options, followed by the command's original help text.
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Wed, 11 Nov 2009 17:48:00 +0100
parents d6a95c5f6ff9
children 931d2c757627
comparison
equal deleted inserted replaced
9875:d6a95c5f6ff9 9876:6e8a16dd3e30
198 try: 198 try:
199 self.fn, self.opts, self.help = cmdutil.findcmd(cmd, cmdtable, False)[1] 199 self.fn, self.opts, self.help = cmdutil.findcmd(cmd, cmdtable, False)[1]
200 self.args = aliasargs(self.fn) + args 200 self.args = aliasargs(self.fn) + args
201 if cmd not in commands.norepo.split(' '): 201 if cmd not in commands.norepo.split(' '):
202 self.norepo = False 202 self.norepo = False
203 if self.help.startswith("hg " + cmd):
204 # drop prefix in old-style help lines so hg shows the alias
205 self.help = self.help[4 + len(cmd):]
206 self.__doc__ = _("alias for: hg %s\n\n%s") \
207 % (definition, self.fn.__doc__)
208
203 except error.UnknownCommand: 209 except error.UnknownCommand:
204 def fn(ui, *args): 210 def fn(ui, *args):
205 ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \ 211 ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \
206 % (self.name, cmd)) 212 % (self.name, cmd))
207 return 1 213 return 1