docs: clan core ref
All checks were successful
checks / checks (pull_request) Successful in 4m24s
checks / checks-impure (pull_request) Successful in 1m46s

This commit is contained in:
Johannes Kirschbauer 2024-04-18 13:05:58 +02:00
parent d2dffe30a3
commit 1a99e033eb
Signed by: hsjobeki
SSH Key Fingerprint: SHA256:vX3utDqig7Ph5L0JPv87ZTPb/w7cMzREKVZzzLFg9qU

View File

@ -70,7 +70,7 @@ def join_lines_with_indentation(lines: list[str], indent: int = 4) -> str:
return "\n".join(indent_str + line for line in lines)
def render_option(name: str, option: dict[str, Any], level: int = 2) -> str:
def render_option(name: str, option: dict[str, Any], level: int = 3) -> str:
read_only = option.get("readOnly")
res = f"""
@ -122,7 +122,9 @@ def module_header(module_name: str) -> str:
def module_usage(module_name: str) -> str:
return f"""To use this module, import it like this:
return f"""## Usage
To use this module, import it like this:
```nix
{{config, lib, inputs, ...}}: {{
@ -133,6 +135,14 @@ def module_usage(module_name: str) -> str:
"""
clan_core_descr = """ClanCore delivers all the essential features for every clan.
It's always included in your setup, and you can customize your clan's behavior with the configuration [options](#module-options) provided below.
"""
options_head = "\n## Module Options\n"
def produce_clan_core_docs() -> None:
if not CLAN_CORE:
raise ValueError(
@ -154,7 +164,8 @@ def produce_clan_core_docs() -> None:
if len(option_name.split(".")) <= 2:
# i.e. clan-core.clanDir
output = core_outputs.get(
outfile, module_header(module_name) + module_usage(module_name)
outfile,
module_header(module_name) + clan_core_descr + options_head,
)
output += render_option(option_name, info)
# Update the content
@ -206,9 +217,9 @@ def produce_clan_modules_docs() -> None:
output += module_usage(module_name)
output += "\n## Module Options\n"
output += options_head if len(options.items()) else ""
for option_name, info in options.items():
output += render_option(option_name, info, 3)
output += render_option(option_name, info)
outfile = Path(OUT) / f"clanModules/{module_name}.md"
outfile.parent.mkdir(