Fix :help command completion
authorJack Miller <jack@codezen.org>
Tue, 9 Jun 2015 18:12:07 +0000 (13:12 -0500)
committerJack Miller <jack@codezen.org>
Tue, 9 Jun 2015 18:12:07 +0000 (13:12 -0500)
canto_curses/command.py
canto_curses/guibase.py

index 925276f..d7b4520 100644 (file)
@@ -63,26 +63,19 @@ def register_commands(obj, cmds, group="hidden"):
         register_command(obj, name, func, args, help_text, group)
 
 def commands():
-    c = {}
+    c = []
 
     for ck in cmds.keys():
         group = cmds[ck][-1].group
+        if group == "hidden":
+            continue
+
         for ak in aliases.keys():
             if aliases[ak][-1].longform == ck:
-                if group in c:
-                    c[group].append(ak)
-                else:
-                    c[group] = [ak]
+                c.append(ak)
                 break
         else:
-            if group in c:
-                c[group].append(ck)
-            else:
-                c[group] = [ck]
-
-    if "hidden" in c:
-        del c["hidden"]
-
+                c.append(ck)
     return c
 
 def command_help(command, detailed=False):
index 732534d..e829856 100644 (file)
@@ -251,9 +251,8 @@ class GuiBase(CommandHandler):
         def help_validator(x):
             if x in ["commands", "cmds"]:
                 return (True, 'commands')
-            for group in help_cmds:
-                if x in help_cmds[group]:
-                    return (True, x)
+            if x in help_cmds:
+                return (True, x)
             return (True, 'all')
 
         return (help_cmds, help_validator)