cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/2] git commit: CLOUDSTACK-7456: Add command line flag -d to control output display
Date Tue, 09 Sep 2014 12:29:40 GMT
Repository: cloudstack-cloudmonkey
Updated Branches:
  refs/heads/master 9662e6bcc -> b8fc61e99


CLOUDSTACK-7456: Add command line flag -d to control output display

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/f1f27e31
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/f1f27e31
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/f1f27e31

Branch: refs/heads/master
Commit: f1f27e31c1d9ac5baa30b66e1ab0e0a5da7a0f7e
Parents: 9662e6b
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Tue Sep 9 14:12:01 2014 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Tue Sep 9 14:12:01 2014 +0200

----------------------------------------------------------------------
 cloudmonkey/cloudmonkey.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/f1f27e31/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/cloudmonkey.py b/cloudmonkey/cloudmonkey.py
index 9264d0e..bc5530c 100644
--- a/cloudmonkey/cloudmonkey.py
+++ b/cloudmonkey/cloudmonkey.py
@@ -563,14 +563,21 @@ class CloudMonkeyShell(cmd.Cmd, object):
 
 
 def main():
+    displayTypes = ["json", "table", "default"]
     parser = argparse.ArgumentParser(usage="cloudmonkey [options] [commands]",
                                      version="cloudmonkey " + __version__,
                                      description=__description__,
                                      epilog="Try cloudmonkey [help|?]")
+
     parser.add_argument("-c", "--config-file",
                         dest="configFile", default=config_file,
                         help="config file for cloudmonkey", metavar="FILE")
 
+    parser.add_argument("-d", "--display-type",
+                        dest="displayType", default=None,
+                        help="Output display type, json, table or default",
+                        choices=tuple(displayTypes))
+
     parser.add_argument("commands", nargs=argparse.REMAINDER,
                         help="api commands")
 
@@ -579,6 +586,9 @@ def main():
 
     shell = CloudMonkeyShell(sys.argv[0], args.configFile)
 
+    if args.displayType != None and args.displayType in displayTypes:
+        shell.set_attr("display", args.displayType)
+
     if len(args.commands) > 0:
         shell.onecmd(' '.join(args.commands))
     else:


Mime
View raw message