mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
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:
parent
f25a78111f
commit
7ce53e89aa
@ -268,7 +268,13 @@ class CloudStackShell(cmd.Cmd):
|
|||||||
lexp = shlex.shlex(args.strip())
|
lexp = shlex.shlex(args.strip())
|
||||||
lexp.whitespace = " "
|
lexp.whitespace = " "
|
||||||
lexp.whitespace_split = True
|
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]
|
api_name = args[0]
|
||||||
|
|
||||||
args_dict = dict(map(lambda x: [x.partition("=")[0],
|
args_dict = dict(map(lambda x: [x.partition("=")[0],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user