34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""
|
|
python3 -m docgen contract > docgen-contract.md
|
|
|
|
Print the instructions to hand to a model that writes `docgen.toml` and notes —
|
|
`docs/models.md`, verbatim.
|
|
|
|
One copy of the wording, printed rather than remembered, the same arrangement as
|
|
`explode.sh --contract`: what a model is asked to write and what docgen accepts
|
|
cannot drift apart, because `selftest.py` checks the file against the loaders —
|
|
every key named, every example loading. Attach it; do not paste it into a
|
|
message body, where markdown gets a say first.
|
|
|
|
With `explode`, attach both: explode's contract says how to format the reply,
|
|
this one says what goes in the files.
|
|
"""
|
|
|
|
import argparse
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from .common import PROG, Abort
|
|
|
|
CONTRACT = Path(__file__).resolve().parent.parent / "docs" / "models.md"
|
|
|
|
|
|
def main(argv) -> int:
|
|
p = argparse.ArgumentParser(prog=f"{PROG} contract",
|
|
description="Print the instructions for a model.")
|
|
p.parse_args(argv)
|
|
if not CONTRACT.is_file():
|
|
raise Abort(f"{CONTRACT} is missing — is the docgen folder intact?")
|
|
sys.stdout.write(CONTRACT.read_text())
|
|
return 0
|