cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/7] git commit: cli: add grammar to class
Date Mon, 05 Nov 2012 16:29:19 GMT
Updated Branches:
  refs/heads/master fe7b28ea0 -> c10eeb603


cli: add grammar to class

Signed-off-by: Rohit Yadav <bhaisaab@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/98d341d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/98d341d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/98d341d9

Branch: refs/heads/master
Commit: 98d341d9325377b0beaf8dafb3ad4092bed3f383
Parents: 9464949
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Mon Nov 5 21:56:39 2012 +0530
Committer: Rohit Yadav <bhaisaab@apache.org>
Committed: Mon Nov 5 21:59:03 2012 +0530

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


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/98d341d9/tools/cli/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py
index 4086b20..ebb03e7 100644
--- a/tools/cli/cloudmonkey/cloudmonkey.py
+++ b/tools/cli/cloudmonkey/cloudmonkey.py
@@ -51,6 +51,7 @@ class CloudStackShell(cmd.Cmd):
     intro = "☁ Apache CloudStack CLI. Type help or ? to list commands.\n"
     ruler = "-"
     config_file = os.path.expanduser('~/.cloudmonkey_config')
+    grammar = []
 
     # datastructure {'list': {'users': ['listUsers', [params], docstring]}}
     cache_verbs = {}
@@ -124,6 +125,9 @@ class CloudStackShell(cmd.Cmd):
     def emptyline(self):
         pass
 
+    def set_grammar(self, grammar):
+        self.grammar = grammar
+
     def print_shell(self, *args):
         try:
             for arg in args:
@@ -362,10 +366,12 @@ def main():
         grammar_handler.__name__ = 'do_' + rule
         setattr(self, grammar_handler.__name__, grammar_handler)
 
+    shell = CloudStackShell()
+    shell.set_grammar(grammar)
     if len(sys.argv) > 1:
-        CloudStackShell().onecmd(' '.join(sys.argv[1:]))
+        shell.onecmd(' '.join(sys.argv[1:]))
     else:
-        CloudStackShell().cmdloop()
+        shell.cmdloop()
 
 if __name__ == "__main__":
     main()


Mime
View raw message