generated from coulomb/repo-seed
feat(cli): add open-reuse validate and register portfolio integrations
Some checks failed
ci / validate-registry (push) Has been cancelled
Some checks failed
ci / validate-registry (push) Has been cancelled
Implement Integration Definition validator CLI with schema and index checks, pytest suite, and CI workflow. Register open-cmis-tck and issue-core-gitea in the integration index. Closes OPEN-WP-0003 and OPEN-WP-0004.
This commit is contained in:
74
open_reuse/cli.py
Normal file
74
open_reuse/cli.py
Normal file
@@ -0,0 +1,74 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from open_reuse.validate import run_validate
|
||||
|
||||
|
||||
def _build_parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(prog="open-reuse")
|
||||
subparsers = parser.add_subparsers(dest="command", required=True)
|
||||
|
||||
validate = subparsers.add_parser(
|
||||
"validate",
|
||||
help="Validate integration definitions and registry index",
|
||||
)
|
||||
validate.add_argument(
|
||||
"paths",
|
||||
nargs="*",
|
||||
type=Path,
|
||||
help="Integration definition files (default: registry/integrations/*.integration.yaml)",
|
||||
)
|
||||
validate.add_argument(
|
||||
"--root",
|
||||
type=Path,
|
||||
default=None,
|
||||
help="open-reuse repository root (auto-detected when omitted)",
|
||||
)
|
||||
validate.add_argument(
|
||||
"--repos-base",
|
||||
type=Path,
|
||||
default=None,
|
||||
help="Base directory containing consuming repos for external definition checks",
|
||||
)
|
||||
validate.add_argument(
|
||||
"--no-index",
|
||||
action="store_true",
|
||||
help="Skip indexes/integrations.yaml checks",
|
||||
)
|
||||
validate.add_argument(
|
||||
"--indexed-only",
|
||||
action="store_true",
|
||||
help="When checking index, skip local definition drift warnings",
|
||||
)
|
||||
validate.add_argument(
|
||||
"--fail-on-warnings",
|
||||
action="store_true",
|
||||
help="Exit non-zero when promotion-gate warnings are present",
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
parser = _build_parser()
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
if args.command == "validate":
|
||||
targets = args.paths or None
|
||||
return run_validate(
|
||||
root=args.root,
|
||||
targets=targets,
|
||||
repos_base=args.repos_base,
|
||||
fail_on_warnings=args.fail_on_warnings,
|
||||
check_index=not args.no_index,
|
||||
indexed_only=args.indexed_only,
|
||||
)
|
||||
|
||||
parser.error(f"unknown command: {args.command}")
|
||||
return 2
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user