Ravi Nori has uploaded a new change for review. Change subject: cli: mismatch between restore snapshot syntax and auto completion(#1027298) ......................................................................
cli: mismatch between restore snapshot syntax and auto completion(#1027298) auto completion for restore snapshot is: action snapshot xxx --vm-identifier xxx restore filling in the missing values, results "error: syntax error" action snapshot xxx --vm-identifier xxx restore If the command is action the line is formated to place all parameters and its values at the end of the line Change-Id: I985d9f084ca3009ba165ca43a5ef01718b7b06e6 Bug-Url: https://bugzilla.redhat.com/1027298 Signed-off-by: Ravi Nori <[email protected]> --- M src/ovirtcli/shell/engineshell.py 1 file changed, 21 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/51/21051/1 diff --git a/src/ovirtcli/shell/engineshell.py b/src/ovirtcli/shell/engineshell.py index 15ea353..ad6b339 100644 --- a/src/ovirtcli/shell/engineshell.py +++ b/src/ovirtcli/shell/engineshell.py @@ -127,6 +127,25 @@ else: print self.prompt + def __reformat_command(self, s): + line = '' + arguments = '' + tokens = s.split(' ') + tokens_len = len(tokens) + i = 0 + while i < tokens_len: + if tokens[i].startswith('--'): + arguments = arguments + ' ' + tokens[i].strip() + i = i + 1 + if i < tokens_len and not tokens[i].startswith('--'): + arguments = arguments + ' ' + tokens[i].strip() + i = i + 1 + else: + line = line + ' ' + tokens[i].strip() + i = i + 1 + + return line.strip() + ' ' + arguments.strip() + def onecmd(self, s): if not s.startswith('#'): command = s.split(' ')[0] @@ -149,6 +168,8 @@ s = self.__input_buffer self.__input_buffer = '' self.__set_prompt(mode=PromptMode.Original) + if command == 'action': + s = self.__reformat_command(s) return cmd.Cmd.onecmd(self, s) finally: if self.context.status == \ -- To view, visit http://gerrit.ovirt.org/21051 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I985d9f084ca3009ba165ca43a5ef01718b7b06e6 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-cli Gerrit-Branch: master Gerrit-Owner: Ravi Nori <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
