From 51fff567ddd35ea39638bdfa407ac9e8dd3309d0 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Wed, 14 Apr 2021 22:03:17 +0300 Subject: [PATCH] Add a version flag. --- .gitlab-ci.yml | 1 + template/__init__.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a3e5c6d..7e45650 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,7 @@ install-wheel: extends: .install-wheel script: - template --help + - template --version test: stage: test diff --git a/template/__init__.py b/template/__init__.py index 59ce2f8..ccf326d 100644 --- a/template/__init__.py +++ b/template/__init__.py @@ -53,7 +53,15 @@ def main(): help="Output to filename", type=argparse.FileType("w"), ) + parser.add_argument( + "-V", + "--version", + help="Template version", + action="store_true", + ) args = parser.parse_args() + if args.version: + print("Template version {}.".format(__version__)) infd = args.filename if args.filename else sys.stdin outfd = args.output if args.output else sys.stdout print(render(infd.read()), file=outfd) -- GitLab