From b9635123a05db189a10b23c1fb79be880ac34d3d Mon Sep 17 00:00:00 2001 From: Radim Date: Tue, 31 Oct 2017 21:08:24 +0100 Subject: [PATCH] Update shell.py fix autocompletion on no input text --- configshell/shell.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configshell/shell.py b/configshell/shell.py index 9832df7..4113a5a 100644 --- a/configshell/shell.py +++ b/configshell/shell.py @@ -689,7 +689,13 @@ def _complete(self, text, state): # result_trees gives us a token name on a second parser call self.log.debug("Faking text entry on commandline.") parse_results = self._parse_cmdline(cmdline + 'x')[0] - end += 1 + #end += 1 + if parse_results.command.value == 'x': + current_token = 'command' + elif 'x' in [x.value for x in parse_results.pparams]: + current_token = 'pparam' + elif 'x' in [x.value for x in parse_results.kparams]: + current_token = 'kparam' if path and beg == parse_results.path.location: current_token = 'path'