Skip to content

Commit eb4886d

Browse files
committed
feat: show version info #13
1 parent 269941c commit eb4886d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/commitlint/__version__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""
2+
This module contains the version information of the current commitlint.
3+
TODO: automatically bump version through CI.
4+
"""
5+
6+
__version__ = "0.2.1"

src/commitlint/cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
commitlint --file path/to/your/file.txt
1313
1414
"""
15+
1516
import argparse
1617
import os
1718
import sys
1819
from typing import List
1920

21+
from .__version__ import __version__
2022
from .commitlint import check_commit_message, remove_comments
2123
from .exceptions import CommitlintException
2224
from .git_helpers import get_commit_message_of_hash, get_commit_messages_of_hash_range
@@ -37,6 +39,11 @@ def get_args() -> argparse.Namespace:
3739
description="Check if a commit message follows the conventional commit format."
3840
)
3941

42+
# version
43+
parser.add_argument(
44+
"-V", "--version", action="version", version=f"%(prog)s {__version__}"
45+
)
46+
4047
# for commit message check
4148
group = parser.add_mutually_exclusive_group(required=True)
4249
group.add_argument(

0 commit comments

Comments
 (0)