Updated Branches:
  refs/heads/master f25a78111 -> 7ce53e89a

cli: make parse in posix mode

Posix mode allows the parse to:
- split by whitespace but value="between quotes are retained or enclose"
- quotes are stripped out

Signed-off-by: Rohit Yadav <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7ce53e89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7ce53e89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7ce53e89

Branch: refs/heads/master
Commit: 7ce53e89aa52a57b7cfc50fd2724f0abce6c25f4
Parents: f25a781
Author: Rohit Yadav <[email protected]>
Authored: Sat Nov 17 04:05:11 2012 +0530
Committer: Rohit Yadav <[email protected]>
Committed: Sat Nov 17 04:07:35 2012 +0530

----------------------------------------------------------------------
 tools/cli/cloudmonkey/cloudmonkey.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7ce53e89/tools/cli/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cloudmonkey.py 
b/tools/cli/cloudmonkey/cloudmonkey.py
index 7157af3..ac191bc 100644
--- a/tools/cli/cloudmonkey/cloudmonkey.py
+++ b/tools/cli/cloudmonkey/cloudmonkey.py
@@ -268,7 +268,13 @@ class CloudStackShell(cmd.Cmd):
         lexp = shlex.shlex(args.strip())
         lexp.whitespace = " "
         lexp.whitespace_split = True
-        args = list(lexp)
+        lexp.posix = True
+        args = []
+        while True:
+            next_val = lexp.next()
+            if next_val is None:
+                break
+            args.append(next_val)
         api_name = args[0]
 
         args_dict = dict(map(lambda x: [x.partition("=")[0],

Reply via email to