You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/11/05 17:29:19 UTC
[2/7] git commit: cli: fix parsing args
cli: fix parsing args
Signed-off-by: Rohit Yadav <bh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/64907c1d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/64907c1d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/64907c1d
Branch: refs/heads/master
Commit: 64907c1da4318f37ebd71770713a358f24406790
Parents: c444bb3
Author: Rohit Yadav <bh...@apache.org>
Authored: Mon Nov 5 21:57:59 2012 +0530
Committer: Rohit Yadav <bh...@apache.org>
Committed: Mon Nov 5 21:59:03 2012 +0530
----------------------------------------------------------------------
tools/cli/cloudmonkey/cloudmonkey.py | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/64907c1d/tools/cli/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py
index 05ea886..3e09cb7 100644
--- a/tools/cli/cloudmonkey/cloudmonkey.py
+++ b/tools/cli/cloudmonkey/cloudmonkey.py
@@ -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)