Skip to content

Commit 7647e12

Browse files
committed
Added -v argument
1 parent f8cb16c commit 7647e12

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
22
current_version = 0.1.0
3-
files = setup.py
3+
files = setup.py coverage_badge/__main__.py
44
commit = True
55
tag = True

coverage_badge/__main__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
coverage = None
1515

1616

17+
__version__ = '0.1.0'
18+
19+
1720
class Devnull(object):
1821
"""
1922
A file like object that does nothing.
@@ -51,6 +54,8 @@ def parse_args():
5154
help='Save the file to the specified path.')
5255
parser.add_argument('-q', dest='quiet', action='store_true',
5356
help='Don\'t output any non-error messages.')
57+
parser.add_argument('-v', dest='print_version', action='store_true',
58+
help='Show version.')
5459
return parser.parse_args()
5560

5661

@@ -86,6 +91,11 @@ def main():
8691
"""
8792
args = parse_args()
8893

94+
# Print version
95+
if args.print_version:
96+
print('coverage-badge v{}'.format(__version__))
97+
sys.exit(0)
98+
8999
# Check for coverage
90100
if coverage is None:
91101
print('Error: Python coverage module not installed.')

0 commit comments

Comments
 (0)