Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show version info #23

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = [email protected], [email protected]
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