Skip to content

Commit

Permalink
feat: show version info #13
Browse files Browse the repository at this point in the history
  • Loading branch information
aj3sh committed Feb 14, 2024
1 parent 269941c commit 0a5f9c1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = commitlint
version = 0.2.1
version = attr: commitlint.__version__.__version__
license = MIT
author = opensource-nepal
author_email = aj3sshh@gmail.com, sugatbajracharya49@gmail.com
Expand Down
1 change: 1 addition & 0 deletions src/commitlint/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Main module for commitlint"""

from .commitlint import check_commit_message

__all__ = ["check_commit_message"]
6 changes: 6 additions & 0 deletions src/commitlint/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""
This module contains the version information of the current commitlint.
TODO: automatically bump version through CI.
"""

__version__ = "0.2.1"
7 changes: 7 additions & 0 deletions src/commitlint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
commitlint --file path/to/your/file.txt
"""

import argparse
import os
import sys
from typing import List

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

# version
parser.add_argument(
"-V", "--version", action="version", version=f"%(prog)s {__version__}"
)

# for commit message check
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
Expand Down

0 comments on commit 0a5f9c1

Please sign in to comment.