[Getan-commits] [PATCH] More and better information in --version

Wald Commits scm-commit at wald.intevation.org
Wed May 2 13:01:39 CEST 2018


# HG changeset patch
# User Magnus Schieder <mschieder at intevation.de>
# Date 1525258837 -7200
# Node ID 7fc3da3c100dbf5fd97305b78d6ccf19f2a9e362
# Parent  2ab6fdde1010d5e192dc241b4d2d939c739b4b8d
More and better information in --version.

diff -r 2ab6fdde1010 -r 7fc3da3c100d getan/main.py
--- a/getan/main.py	Mon Apr 30 14:13:05 2018 +0200
+++ b/getan/main.py	Wed May 02 13:00:37 2018 +0200
@@ -14,6 +14,7 @@
 import os
 import os.path
 import argparse
+import textwrap
 
 import getan
 import getan.config as config
@@ -28,10 +29,19 @@
 
     usage = "%(prog)s [options] [databasefile (default: " + \
         DEFAULT_DATABASE + ")]"
-    version = "getan version %s, LICENSE GNU GPL v>=3" % getan.__version__
+    version = '''
+    getan version %s,
+    (c) 2017 by Intevation
+        Author: Bernhard.Reiter at intevation.de
 
-    parser = argparse.ArgumentParser(prog='getan', usage=usage)
-    parser.add_argument('--version', action='version', version=version)
+    This is Free Software licensed under the terms of GPLv3 or later.
+    For details see LICENSE coming with the source of \'getan\'.
+    ''' % getan.__version__
+
+    parser = argparse.ArgumentParser(prog='getan', usage=usage,
+             formatter_class=argparse.RawTextHelpFormatter)
+    parser.add_argument('--version', action='version',
+                        version=textwrap.dedent(version))
     parser.add_argument(dest='filename', nargs='?',
                         help='[databasefile (default: %(default)s)]',
                         default=DEFAULT_DATABASE)


More information about the Getan-commits mailing list