[svn] commit: r1445 - in /trunk/src: bin/bindctl/bindcmd.py lib/python/isc/config/config_data.py

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Mar 16 13:30:23 UTC 2010


Author: jelte
Date: Tue Mar 16 13:30:23 2010
New Revision: 1445

Log:
fixed a bug in tab-completion

Modified:
    trunk/src/bin/bindctl/bindcmd.py
    trunk/src/lib/python/isc/config/config_data.py

Modified: trunk/src/bin/bindctl/bindcmd.py
==============================================================================
--- trunk/src/bin/bindctl/bindcmd.py (original)
+++ trunk/src/bin/bindctl/bindcmd.py Tue Mar 16 13:30:23 2010
@@ -326,7 +326,10 @@
             line = 'help'
         
         Cmd.onecmd(self, line)
-                    
+
+    def remove_prefix(self, list, prefix):
+        return [(val[len(prefix):]) for val in list]
+
     def complete(self, text, state):
         if 0 == state:
             text = text.strip()
@@ -342,9 +345,10 @@
                     if cmd.module == "config":
                         # grm text has been stripped of slashes...
                         my_text = self.location + "/" + cur_line.rpartition(" ")[2]
-                        print("[XX] completing config part")
-                        list = self.config_data.get_config_item_list(my_text.rpartition("/")[0])
-                        hints.extend([val for val in list if val.startswith(text)])
+                        list = self.config_data.get_config_item_list(my_text.rpartition("/")[0], True)
+                        hints.extend([val for val in list if val.startswith(my_text[1:])])
+                        # remove the common prefix from the hints so we don't get it twice
+                        hints = self.remove_prefix(hints, my_text.rpartition("/")[0])
             except CmdModuleNameFormatError:
                 if not text:
                     hints = self.get_module_names()

Modified: trunk/src/lib/python/isc/config/config_data.py
==============================================================================
--- trunk/src/lib/python/isc/config/config_data.py (original)
+++ trunk/src/lib/python/isc/config/config_data.py Tue Mar 16 13:30:23 2010
@@ -401,6 +401,8 @@
            the identifier (up to the first /) is interpreted as the
            module name"""
         if identifier and identifier != "/":
+            if identifier.startswith("/"):
+                identifier = identifier[1:]
             spec = self.find_spec_part(identifier)
             return spec_name_list(spec, identifier + "/", recurse)
         else:




More information about the bind10-changes mailing list