help: enable listing of a subset of the command list
authorJohannes Stezenbach <js@sig21.net>
Sat, 07 Jun 2008 09:49:34 +0200
changeset 6652 ffcf8e82f647
parent 6650 2c9565971abc
child 6653 a78d8edaeedd
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.
mercurial/commands.py
--- 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])