diff --git a/src/griffe/agents/extensions/__init__.py b/src/griffe/agents/extensions/__init__.py index 86824eb7..d0520ef9 100644 --- a/src/griffe/agents/extensions/__init__.py +++ b/src/griffe/agents/extensions/__init__.py @@ -1,5 +1,5 @@ """This module is the public interface to import elements from the base.""" -from griffe.agents.extensions.base import Extension, Extensions, When, load_extensions +from griffe.agents.extensions.base import Extension, Extensions, When, load_extension, load_extensions -__all__ = ["Extensions", "Extension", "When", "load_extensions"] # noqa: WPS410 +__all__ = ["Extensions", "Extension", "When", "load_extension", "load_extensions"] # noqa: WPS410 diff --git a/src/griffe/cli.py b/src/griffe/cli.py index a89f58b4..e92c8327 100644 --- a/src/griffe/cli.py +++ b/src/griffe/cli.py @@ -22,6 +22,7 @@ from typing import Any, Sequence from griffe.agents.extensions import Extensions +from griffe.agents.extensions.base import load_extensions from griffe.docstrings.parsers import Parser from griffe.encoders import Encoder from griffe.loader import AsyncGriffeLoader, GriffeLoader @@ -108,6 +109,13 @@ def get_parser() -> argparse.ArgumentParser: action="store_true", help="Whether to append sys.path to search paths specified with -s.", ) + parser.add_argument( + "-e", + "--extensions", + default={}, + type=json.loads, + help="A list of extensions to use.", + ) parser.add_argument( "-f", "--full", @@ -180,7 +188,7 @@ def main(args: list[str] | None = None) -> int: # noqa: WPS231 if opts.append_sys_path: search.extend(sys.path) - extensions = Extensions() + extensions = load_extensions(opts.extensions) if opts.async_loader: loop = asyncio.get_event_loop()