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):
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 @@ class BindCmdInterpreter(Cmd):
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()
......
......@@ -401,6 +401,8 @@ class MultiConfigData:
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:
......
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