MCPcopy Index your code
hub / github.com/github/spec-kit / _delegate_command

Function _delegate_command

src/specify_cli/bundler/services/primitives.py:99–111  ·  view source on GitHub ↗

Run a delegated CLI command callable, translating its exit into errors.

(action: str, label: str, call)

Source from the content-addressed store, hash-verified

97
98
99def _delegate_command(action: str, label: str, call) -> None:
100 """Run a delegated CLI command callable, translating its exit into errors."""
101 import typer
102
103 try:
104 call()
105 except typer.Exit as exc: # raised by the delegated command on failure
106 code = getattr(exc, "exit_code", 0) or 0
107 if code != 0:
108 raise BundlerError(f"Failed to {action} {label}.") from exc
109 except SystemExit as exc: # pragma: no cover - defensive
110 if exc.code not in (0, None):
111 raise BundlerError(f"Failed to {action} {label}.") from exc
112
113
114class _PresetKindManager:

Callers 4

installMethod · 0.85
removeMethod · 0.85
installMethod · 0.85
removeMethod · 0.85

Calls 1

BundlerErrorClass · 0.85

Tested by

no test coverage detected