feat(mindmodel): add CLI wrapper and tests
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
def main(argv: Optional[List[str]] = None) -> int:
|
||||
"""CLI wrapper that delegates to scripts.mindmodel.validator.main.
|
||||
|
||||
Returns the integer exit code from the delegated main. If the
|
||||
validator module is not available or raises, return a non-zero
|
||||
exit code.
|
||||
"""
|
||||
try:
|
||||
# Import here to avoid side-effects on module import
|
||||
from scripts.mindmodel import validator
|
||||
|
||||
# Call the validator.main if present
|
||||
if hasattr(validator, "main"):
|
||||
result = validator.main(argv)
|
||||
# Ensure we return an int
|
||||
try:
|
||||
return int(result) # type: ignore
|
||||
except Exception:
|
||||
return 1
|
||||
else:
|
||||
return 2
|
||||
except Exception:
|
||||
# Import error or runtime error — return non-zero so callers
|
||||
# can detect failure (tests expect non-zero on missing manifest)
|
||||
return 2
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user