API/Modules-list: List only inventory modules

This commit is contained in:
Johannes Kirschbauer
2024-10-17 10:27:00 +02:00
parent 688671bab8
commit c6eb7545bb

View File

@@ -134,9 +134,10 @@ def get_roles(module_path: Path) -> None | list[str]:
@dataclass @dataclass
class ModuleInfo: class ModuleInfo:
description: str description: str
categories: list[str] | None readme: str
categories: list[str]
roles: list[str] | None roles: list[str] | None
readme: str | None = None features: list[str] = field(default_factory=list)
def get_modules(base_path: str) -> dict[str, str]: def get_modules(base_path: str) -> dict[str, str]:
@@ -179,7 +180,7 @@ def get_module_info(
""" """
Retrieves information about a module Retrieves information about a module
""" """
if not module_path: if not module_path.exists():
msg = "Module not found" msg = "Module not found"
raise ClanError( raise ClanError(
msg, msg,
@@ -205,6 +206,7 @@ def get_module_info(
categories=frontmatter.categories, categories=frontmatter.categories,
roles=get_roles(module_path), roles=get_roles(module_path),
readme=readme_content, readme=readme_content,
features=["inventory"] if has_inventory_feature(module_path) else [],
) )