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 <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2012-11-17 04:05:11 +05:30
parent f25a78111f
commit 7ce53e89aa

View File

@ -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],