Skip to content

Commit e6aec02

Browse files
committed
Merge branch 'main' of github.com:mkdocstrings/griffe
2 parents 3feb2bd + a41515f commit e6aec02

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/griffe/c3linear.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def head(self) -> T | None:
2525

2626
@property
2727
def tail(self) -> islice:
28-
"""Tail od the dependency.
28+
"""Tail of the dependency.
2929
3030
The `islice` object is sufficient for iteration or testing membership (`in`).
3131
"""

src/griffe/cli.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import os
2020
import sys
2121
from datetime import datetime, timezone
22+
from importlib.metadata import PackageNotFoundError
23+
from importlib.metadata import version as get_dist_version
2224
from pathlib import Path
2325
from typing import IO, TYPE_CHECKING, Any, Callable, Sequence
2426

@@ -42,6 +44,13 @@
4244
logger = get_logger(__name__)
4345

4446

47+
def _get_griffe_version() -> str:
48+
try:
49+
return get_dist_version("griffe")
50+
except PackageNotFoundError:
51+
return "0.0.0"
52+
53+
4554
def _print_data(data: str, output_file: str | IO | None) -> None:
4655
if isinstance(output_file, str):
4756
with open(output_file, "w") as fd:
@@ -122,6 +131,7 @@ def get_parser() -> argparse.ArgumentParser:
122131

123132
global_options = parser.add_argument_group(title="Global options")
124133
global_options.add_argument("-h", "--help", action="help", help=main_help)
134+
global_options.add_argument("-V", "--version", action="version", version="%(prog)s " + _get_griffe_version())
125135

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

src/griffe/mixins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def as_json(self, *, full: bool = False, **kwargs: Any) -> str:
247247
**kwargs: Additional serialization options passed to encoder.
248248
249249
Returns:
250-
A string.
250+
A JSON string.
251251
"""
252252
from griffe.encoders import JSONEncoder # avoid circular import
253253

0 commit comments

Comments
 (0)