Show version in command line.

Mon, 27 Feb 2017 15:08:35 +0200

author
Iannis <ulalume3@yahoo.com>
date
Mon, 27 Feb 2017 15:08:35 +0200
changeset 67
c7e64cfab199
parent 66
51b799247d67
child 68
b0ce0f140b0e

Show version in command line.

atmospheric_lidar/scripts/licel2scc.py file | annotate | diff | comparison | revisions
atmospheric_lidar/scripts/licel2scc_depol.py file | annotate | diff | comparison | revisions
--- a/atmospheric_lidar/scripts/licel2scc.py	Sun Feb 26 22:30:27 2017 +0200
+++ b/atmospheric_lidar/scripts/licel2scc.py	Mon Feb 27 15:08:35 2017 +0200
@@ -9,6 +9,7 @@
 
 
 from ..licel import LicelLidarMeasurement
+from ..__init__ import __version__
 
 
 def create_custom_class(custom_netcdf_parameter_path, use_id_as_name=False, temperature=25., pressure=1020.):
@@ -96,6 +97,7 @@
     parser.add_argument('-s', '--silent', help="Show only warning and error messages.", action="store_const",
                         dest="loglevel", const=logging.WARNING
                         )
+    parser.add_argument('--version', help="Show current version.", action='store_true')
 
     args = parser.parse_args()
 
@@ -105,6 +107,10 @@
 
     #coloredlogs.install(fmt='%(levelname)s: %(message)s', level=args.loglevel)
 
+    if args.version:
+        print("Version: %s" % __version__)
+        sys.exit(0)
+
     # Get a list of files to convert
     search_str = os.path.join(args.directory, args.search_string)
     files = glob.glob(search_str)
--- a/atmospheric_lidar/scripts/licel2scc_depol.py	Sun Feb 26 22:30:27 2017 +0200
+++ b/atmospheric_lidar/scripts/licel2scc_depol.py	Mon Feb 27 15:08:35 2017 +0200
@@ -9,6 +9,7 @@
 
 
 from ..licel_depol import LicelCalibrationMeasurement
+from ..__init__ import __version__
 
 
 def create_custom_class(custom_netcdf_parameter_path, use_id_as_name=False, temperature=25., pressure=1020.):
@@ -95,6 +96,7 @@
     parser.add_argument('-s', '--silent', help="Show only warning and error messages.", action="store_const",
                         dest="loglevel", const=logging.WARNING
                         )
+    parser.add_argument('--version', help="Show current version.", action='store_true')
 
     args = parser.parse_args()
 
@@ -104,6 +106,10 @@
 
     #coloredlogs.install(fmt='%(levelname)s: %(message)s', level=args.loglevel)
 
+    if args.version:
+        print("Version: %s" % __version__)
+        sys.exit(0)
+
     # Get a list of files to convert
     plus45_files = glob.glob(args.plus45_string)
     minus45_files = glob.glob(args.minus45_string)

mercurial