Skip to content

Commit 95f9339

Browse files
committed
Add --version flag
1 parent 88790ee commit 95f9339

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

gtbump/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import subprocess
55
import sys
66

7+
__version__ = "0.3.0"
8+
79
MAJOR = "major"
810
MINOR = "minor"
911
PATCH = "patch"
@@ -83,6 +85,8 @@ def main():
8385
dest="strip_suffix", help="strip existing suffx from tag (eg: -beta.0)")
8486
p.add_argument("-s", "--suffix", action="store", type=str,
8587
dest="suffix", help="optional suffix to add to the tag (eg: -beta.0). Pass as =\"-beta\" if the first character is a dash")
88+
p.add_argument("-v", "--version", action="store_true", dest="version",
89+
help="show version")
8690

8791
g = p.add_argument_group("bump").add_mutually_exclusive_group()
8892
g.add_argument("-show", "--show", action="store_true",
@@ -99,6 +103,10 @@ def main():
99103
dest="patch", help="bump the patch version")
100104
args = p.parse_args()
101105

106+
if args.version:
107+
print("v{}".format(__version__))
108+
quit()
109+
102110
# Show the last tag.
103111
try:
104112
if args.show:

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
from codecs import open
33
from setuptools import setup
44

5+
from gtbump import __version__
6+
57
README = open("README.md").read()
68

79
setup(
810
name="gtbump",
9-
version="0.3.0",
11+
version=__version__,
1012
description="git-tag-bump: a simple utility for quickly bumping Git semver tags",
1113
long_description=README,
1214
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)