main: Add an explicit --version argument.
authorW. Trevor King <wking@tremily.us>
Wed, 9 Jan 2013 16:01:17 +0000 (11:01 -0500)
committerW. Trevor King <wking@tremily.us>
Wed, 9 Jan 2013 16:39:31 +0000 (11:39 -0500)
Use an explicit `version` action instead of the undocumented (and
deprecated) `version` keyword to ArgumentParser [1,2].

[1]: http://docs.python.org/3.3/library/argparse.html#action
[2]: http://docs.python.org/3.3/library/argparse.html#upgrading-optparse-code

Signed-off-by: W. Trevor King <wking@tremily.us>
rss2email/main.py

index 5609b518f51d11d5a00373ab9514f12b8d228ad5..47817fe0b996b8751b8c9cff72293f0515d3b577 100644 (file)
@@ -20,8 +20,11 @@ def run(*args, **kwargs):
     `.parse_args()` call without modification.
     """
     parser = _argparse.ArgumentParser(
-        description=_PACKAGE_DOCSTRING, version=__version__)
+        prog='rss2email', description=_PACKAGE_DOCSTRING)
 
+    parser.add_argument(
+        '-v', '--version', action='version',
+        version='%(prog)s {}'.format(__version__))
     parser.add_argument(
         '-c', '--config', metavar='PATH', default=[], action='append',
         help='path to the configuration file')