Skip to content

Commit 97f7bd9

Browse files
authored
Merge pull request #23 from aj3sh/version-info
feat: show version info
2 parents 269941c + 0a5f9c1 commit 97f7bd9

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = commitlint
3-
version = 0.2.1
3+
version = attr: commitlint.__version__.__version__
44
license = MIT
55
author = opensource-nepal
66

src/commitlint/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Main module for commitlint"""
2+
23
from .commitlint import check_commit_message
34

45
__all__ = ["check_commit_message"]

src/commitlint/__version__.py

+6
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

+7
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)