From: W. Trevor King Date: Wed, 9 Jan 2013 16:01:17 +0000 (-0500) Subject: main: Add an explicit --version argument. X-Git-Tag: v3.0~32 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=51172e5befd4b1d1e3891440c10bd1f4e6885e8a;p=rss2email.git main: Add an explicit --version argument. 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 --- diff --git a/rss2email/main.py b/rss2email/main.py index 5609b51..47817fe 100644 --- a/rss2email/main.py +++ b/rss2email/main.py @@ -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')