Ravi Nori has uploaded a new change for review.

Change subject: cli: connect --help will log the user out of the disconnected 
cli
......................................................................

cli: connect --help will log the user out of the disconnected cli

Running connect --help in a disconnect cli will print help message
and log user off cli.

This patch uses a regex to convert command --help to
help command and execute it.

Change-Id: Icffe101260edc5072aec4c8d2a6df0f763591f8b
Bug-Url: https://bugzilla.redhat.com/890340
Signed-off-by: Ravi Nori <[email protected]>
---
M src/ovirtcli/shell/engineshell.py
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/08/13708/1

diff --git a/src/ovirtcli/shell/engineshell.py 
b/src/ovirtcli/shell/engineshell.py
index 82a6552..a277c99 100644
--- a/src/ovirtcli/shell/engineshell.py
+++ b/src/ovirtcli/shell/engineshell.py
@@ -20,6 +20,7 @@
 import cmd
 import signal
 import readline
+import re
 
 from ovirtcli.shell.actioncmdshell import ActionCmdShell
 from ovirtcli.shell.connectcmdshell import ConnectCmdShell
@@ -161,7 +162,15 @@
             self.cmdloop()
 
     def precmd(self, line):
-        return cmd.Cmd.precmd(self, line.lstrip())
+        return cmd.Cmd.precmd(self, self.normalize(line))
+
+    def normalize(self, line):
+        normalized = line.lstrip()
+        rg = re.compile('((?:[a-z][a-z]+))( 
)(-)(-)(help)',re.IGNORECASE|re.DOTALL)
+        m = rg.search(normalized)
+        if m:
+            normalized = 'help ' + m.group(1)
+        return normalized
 
     def parseline(self, line):
         ret = cmd.Cmd.parseline(self, line)


--
To view, visit http://gerrit.ovirt.org/13708
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icffe101260edc5072aec4c8d2a6df0f763591f8b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: cli_3.2
Gerrit-Owner: Ravi Nori <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to