print out version on -v / --version
authorLuc Yriarte <luc.yriarte@intel.com>
Mon, 19 Nov 2012 14:22:20 +0000 (15:22 +0100)
committerLuc Yriarte <luc.yriarte@intel.com>
Mon, 19 Nov 2012 15:37:36 +0000 (16:37 +0100)
README.md
cloudeebus/cloudeebus.py

index 74e7575..aebcce5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -22,13 +22,14 @@ Cloudeebus will install itself in Python's dist-packages folder. The
 The Cloudeebus server must be run either with credentials and a whitelist to
  restrict access to DBus services, or in opendoor mode.
 
-       usage: cloudeebus.py [-h] [-d] [-o] [-p PORT] [-c CREDENTIALS] [-w WHITELIST]
+       usage: cloudeebus.py [-h] [-v] [-d] [-o] [-p PORT] [-c CREDENTIALS] [-w WHITELIST]
        
        Javascript DBus bridge.
        
        optional arguments:
          -h, --help            show this help message and exit
          -d, --debug           log debug info on standard output
+         -v, --version         print version and exit
          -o, --opendoor        allow anonymous access to all services
          -p PORT, --port PORT  port number
          -c CREDENTIALS, --credentials CREDENTIALS
index cb0070c..33b66bb 100755 (executable)
@@ -47,6 +47,7 @@ from twisted.python import log
 
 ###############################################################################
 
+VERSION = "0.1"
 OPENDOOR = False
 CREDENTIALS = {}
 WHITELIST = []
@@ -292,6 +293,8 @@ if __name__ == '__main__':
     cache = DbusCache()
 
     parser = argparse.ArgumentParser(description='Javascript DBus bridge.')
+    parser.add_argument('-v', '--version', action='store_true', 
+        help='print version and exit')
     parser.add_argument('-d', '--debug', action='store_true', 
         help='log debug info on standard output')
     parser.add_argument('-o', '--opendoor', action='store_true',
@@ -305,6 +308,10 @@ if __name__ == '__main__':
     
     args = parser.parse_args(sys.argv[1:])
 
+    if args.version:
+        print("Cloudeebus version " + VERSION)
+        exit(0)
+    
     if args.debug:
         log.startLogging(sys.stdout)