cli.main

cli.main(argv=None)

Run the spotregen command line.

Parameters

Name Type Description Default
argv Sequence[str] | None Command-line arguments without the program name. Defaults to sys.argv[1:]. None

Returns

Name Type Description
int int Exit code. 0 on success, 1 if check found errors (or warnings with --strict) or deletion-test found gaps, or mutate left a mutant alive, or if the last attempt of a driver failed its evaluations or its dependents, 2 on a malformed spec, an unknown unit, a new-unit module that is missing or already recorded, or a driver that lacks a tool (claude, git, lsof) or refuses an option. Argument errors exit with status 2 through SystemExit.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from spotregen import make_sample_repo
from spotregen.cli import main

with TemporaryDirectory() as tmp:
    root = make_sample_repo(Path(tmp) / "demo")
    print("exit", main(["--root", str(root), "check"]))
    print("exit", main(["--root", str(root), "context", "nope"]))
regen check: 1 units, 0 errors, 0 warnings
exit 0
exit 2
spotregen: "unknown unit 'nope'; known: ['samplepkg.core.calc']"