From ba373e13d226f306639bd941aa5c16f4eb2c1f95 Mon Sep 17 00:00:00 2001 From: Faseela K Date: Thu, 30 Apr 2020 18:13:30 +0530 Subject: [PATCH] Fix issues with auto-complete of similar command trees. Signed-off-by: Faseela K --- ishell/command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ishell/command.py b/ishell/command.py index 90e9fee..51ca4f9 100644 --- a/ishell/command.py +++ b/ishell/command.py @@ -49,7 +49,11 @@ def complete(self, line, buf, state, run=False, full_line=None): candidates = self.get_candidates(next_command) if candidates and len(candidates) > 1 and buf: logger.debug("More than one candidate, not walking in %s" % buf) - return self._next_command(state, buf) + if next_command in candidates: + cmd = candidates.pop(next_command) + return cmd.complete(line[1:], buf, state, run, full_line) + else: + return self._next_command(state, buf) elif candidates and next_command in candidates: logger.debug("Found %s in childs, walking." % next_command) cmd = candidates.pop(next_command)