Browse Source

add --version argument handling

Change-Id: I416af26def4d75a6e6dedea30401f458965ec26f
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Doug Hellmann 2 years ago
parent
commit
b4366540c0
1 changed files with 9 additions and 0 deletions
  1. 9
    0
      downpour/app.py

+ 9
- 0
downpour/app.py View File

@@ -17,6 +17,7 @@ import logging
17 17
 import sys
18 18
 
19 19
 import os_client_config
20
+import pkg_resources
20 21
 import shade
21 22
 
22 23
 from downpour import export
@@ -27,6 +28,14 @@ def main():
27 28
     parser = argparse.ArgumentParser()
28 29
     config = os_client_config.OpenStackConfig()
29 30
 
31
+    version_info = pkg_resources.get_distribution('os-downpour').version
32
+    parser.add_argument(
33
+        '--version',
34
+        action='version',
35
+        version='%(prog)s ' + version_info,
36
+        help='show the program version and exit',
37
+    )
38
+
30 39
     verbose_group = parser.add_mutually_exclusive_group()
31 40
     verbose_group.add_argument(
32 41
         '--verbose', '-v',

Loading…
Cancel
Save