cli: fix parsing args

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2012-11-05 21:57:59 +05:30
parent c444bb3811
commit 64907c1da4
1 changed files with 7 additions and 3 deletions

View File

@ -283,10 +283,13 @@ class CloudStackShell(cmd.Cmd):
separator = rline[1]
params = rline[2]
if verb not in self.grammar:
return []
autocompletions = []
search_string = ""
if not verb in self.cache_verbs:
if verb not in self.cache_verbs:
self.cache_verb_miss(verb)
if separator != " ": # Complete verb subjects
@ -352,14 +355,15 @@ def main():
if not rule in self.cache_verbs:
self.cache_verb_miss(rule)
try:
res = self.cache_verbs[rule][args.partition(" ")[0]]
args_partition = args.partition(" ")
res = self.cache_verbs[rule][args_partition[0]]
except KeyError, e:
self.print_shell("Error: no such command on %s" % rule)
return
if '--help' in args:
self.print_shell(res[2])
return
self.default(res[0])
self.default(res[0] + " " + args_partition[2])
return grammar_closure
grammar_handler = add_grammar(rule)