Skip to content

Commit

Permalink
feat: Add --version and -V cli flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarte committed Jul 25, 2023
1 parent 1e7b869 commit eadd2ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/griffe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from griffe.loader import load
from griffe.logger import get_logger

__version__ = "0.32.3"

__all__: list[str] = [
"Attribute",
"Class",
Expand Down
2 changes: 2 additions & 0 deletions src/griffe/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import colorama

from griffe import __version__
from griffe.diff import ExplanationStyle, find_breaking_changes
from griffe.docstrings.parsers import Parser
from griffe.encoders import JSONEncoder
Expand Down Expand Up @@ -122,6 +123,7 @@ def get_parser() -> argparse.ArgumentParser:

global_options = parser.add_argument_group(title="Global options")
global_options.add_argument("-h", "--help", action="help", help=main_help)
global_options.add_argument("-V", "--version", action="version", version=f'%(prog)s ' + __version__)

def add_common_options(subparser: argparse.ArgumentParser) -> None:
common_options = subparser.add_argument_group(title="Common options")
Expand Down

0 comments on commit eadd2ee

Please sign in to comment.