Commit c2e90505 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

fixed a bug in tab-completion


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1445 e5f2f494-b856-4b98-b285-d166d9295462
parent 50520598
...@@ -326,7 +326,10 @@ class BindCmdInterpreter(Cmd): ...@@ -326,7 +326,10 @@ class BindCmdInterpreter(Cmd):
line = 'help' line = 'help'
Cmd.onecmd(self, line) Cmd.onecmd(self, line)
def remove_prefix(self, list, prefix):
return [(val[len(prefix):]) for val in list]
def complete(self, text, state): def complete(self, text, state):
if 0 == state: if 0 == state:
text = text.strip() text = text.strip()
...@@ -342,9 +345,10 @@ class BindCmdInterpreter(Cmd): ...@@ -342,9 +345,10 @@ class BindCmdInterpreter(Cmd):
if cmd.module == "config": if cmd.module == "config":
# grm text has been stripped of slashes... # grm text has been stripped of slashes...
my_text = self.location + "/" + cur_line.rpartition(" ")[2] 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], True)
list = self.config_data.get_config_item_list(my_text.rpartition("/")[0]) hints.extend([val for val in list if val.startswith(my_text[1:])])
hints.extend([val for val in list if val.startswith(text)]) # 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: except CmdModuleNameFormatError:
if not text: if not text:
hints = self.get_module_names() hints = self.get_module_names()
......
...@@ -401,6 +401,8 @@ class MultiConfigData: ...@@ -401,6 +401,8 @@ class MultiConfigData:
the identifier (up to the first /) is interpreted as the the identifier (up to the first /) is interpreted as the
module name""" module name"""
if identifier and identifier != "/": if identifier and identifier != "/":
if identifier.startswith("/"):
identifier = identifier[1:]
spec = self.find_spec_part(identifier) spec = self.find_spec_part(identifier)
return spec_name_list(spec, identifier + "/", recurse) return spec_name_list(spec, identifier + "/", recurse)
else: else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment