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 26, 2023
1 parent 1e7b869 commit ac53cea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/griffe/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import os
import sys
from datetime import datetime, timezone
from importlib.metadata import version as get_version
from pathlib import Path
from typing import IO, TYPE_CHECKING, Any, Callable, Sequence

Expand All @@ -34,6 +35,8 @@
from griffe.logger import get_logger
from griffe.stats import _format_stats

version = get_version("griffe")

if TYPE_CHECKING:
from griffe.extensions import Extensions, ExtensionType

Expand Down Expand Up @@ -122,6 +125,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="%(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 ac53cea

Please sign in to comment.