From dd7e1fbf9f91ce88c54e1c3ef4d47ad9a91d9127 Mon Sep 17 00:00:00 2001 From: Jin Lee Date: Tue, 25 Jun 2019 14:04:19 -0700 Subject: [PATCH] added -v/--version for caper to show version --- caper/caper_args.py | 8 ++++++++ setup.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/caper/caper_args.py b/caper/caper_args.py index bb1ead0b..d4f27337 100644 --- a/caper/caper_args.py +++ b/caper/caper_args.py @@ -11,6 +11,9 @@ import os from distutils.util import strtobool + +__version__ = '0.3.9' + DEFAULT_JAVA_HEAP_SERVER = '5G' DEFAULT_JAVA_HEAP_RUN = '1G' DEFAULT_CAPER_CONF = '~/.caper/default.conf' @@ -194,7 +197,12 @@ def parse_caper_arguments(): conf_parser.add_argument('-c', '--conf', help='Specify config file', metavar='FILE', default=DEFAULT_CAPER_CONF) + conf_parser.add_argument('-v', '--version', action='store_true', + help='Show version') known_args, remaining_argv = conf_parser.parse_known_args() + if known_args.version is not None and known_args.version: + print(__version__) + sys.exit(0) # read conf file if it exists defaults = {} diff --git a/setup.py b/setup.py index 21640903..a0b8d121 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,12 @@ import setuptools +from caper import caper_args with open('README.md', 'r') as fh: long_description = fh.read() setuptools.setup( name='caper', - version='v0.3.8', + version=caper_args.__version__, python_requires='>3.4.1', scripts=['bin/caper', 'mysql/run_mysql_server_docker.sh', 'mysql/run_mysql_server_singularity.sh'],