changeset 6652:ffcf8e82f647

help: enable listing of a subset of the command list Instead of giving the "command %s is ambiguous" error message with a bare list of possible command, display help list for all commands starting with the given string.
author Johannes Stezenbach <js@sig21.net>
date Sat, 07 Jun 2008 09:49:34 +0200
parents 2c9565971abc
children a78d8edaeedd
files mercurial/commands.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jun 06 18:31:57 2008 +0200
+++ b/mercurial/commands.py	Sat Jun 07 09:49:34 2008 +0200
@@ -1253,7 +1253,14 @@
         if with_version:
             version_(ui)
             ui.write('\n')
-        aliases, i = cmdutil.findcmd(ui, name, table)
+
+        try:
+            aliases, i = cmdutil.findcmd(ui, name, table)
+        except cmdutil.AmbiguousCommand, inst:
+            select = lambda c: c.lstrip('^').startswith(inst.args[0])
+            helplist(_('list of commands:\n\n'), select)
+            return
+
         # synopsis
         ui.write("%s\n" % i[2])