thorstenb / odpdown

Generate OpenDocument Presentation (odp) files from markdown
Other
109 stars 18 forks source link

odpdown should have --version / a version number #20

Closed tobp closed 9 years ago

tobp commented 9 years ago

Currently, it is difficult to check whether the version offered via Python's "pip" is the current one or how long lagging behind the current git version

tobp commented 9 years ago

Possible patch. I can't use arg.version as that line is never reached (error: too few arguments), if one only specifies --version.

--- lib/python2.7/site-packages/odpdown.py.old  2015-03-25 08:58:48.551372499 +0100
+++ lib/python2.7/site-packages/odpdown.py      2015-03-25 09:10:19.506265135 +0100
@@ -755,2 +755,6 @@ def main():
     """Command-line conversion tool"""
+    if sys.argv[1] == '--version':
+        print(__version__)
+        exit(0)
+
     parser = argparse.ArgumentParser(
@@ -787,2 +791,4 @@ def main():
                         ' empty or unknown name')
+    parser.add_argument('--version', action="store_true", default=False,
+                        help="Show the version number")
         args = parser.parse_args()