Documentation
¶
Index ¶
- Constants
- func APIErrorCodeToExitCode(code string) int
- func ExitCodeFromError(err error) int
- func HTTPStatusToExitCode(status int) int
- func RootCommand(version string) *ffcli.Command
- func RootCommandWithDeps(version string, d *shared.Deps) *ffcli.Command
- func Run(args []string, versionInfo string) int
- func RunWithDeps(args []string, versionInfo string, d *shared.Deps) (exitCode int)
Constants ¶
const ( ExitSuccess = 0 // Successful execution ExitError = 1 // Generic/unclassified error ExitUsage = 2 // Invalid usage / flags / command invocation ExitAuth = 3 // Authentication failure (missing, unauthorized, forbidden) ExitNotFound = 4 // Resource not found ExitConflict = 5 // Conflict / resource already exists ExitReadOnly = 6 // Read-only mode refused a mutating request ExitPending = 7 // An opted-in bounded wait ended before its target finished (builds wait --report-pending, status --until) // HTTP 4xx range: 10 + (status - 400) // Note: 404 and 409 are mapped to ExitNotFound and ExitConflict above. ExitHTTPBadRequest = 10 // 400 ExitHTTPForbidden = ExitAuth // 403 (special case) ExitHTTPUnprocessable = 32 // 422 // HTTP 5xx range: 60 + (status - 500) ExitHTTPInternalServer = 60 // 500 ExitHTTPBadGateway = 62 // 502 )
Exit codes following the CI/CD specification.
Variables ¶
This section is empty.
Functions ¶
func APIErrorCodeToExitCode ¶
APIErrorCodeToExitCode maps an API error code string to the appropriate exit code.
func ExitCodeFromError ¶
ExitCodeFromError maps an error to the appropriate exit code. This is the single source of truth for exit code determination.
func HTTPStatusToExitCode ¶
HTTPStatusToExitCode maps an HTTP status code to the appropriate exit code.
func RootCommand ¶
RootCommand returns the root command
func RootCommandWithDeps ¶
RootCommandWithDeps returns the root command with the commands that take dependencies built on d.
func Run ¶
Run executes the CLI using the provided args (not including argv[0]) and version string. It returns the intended process exit code.
func RunWithDeps ¶
RunWithDeps is Run with the commands that take dependencies built on d, and the root's own output written to d's streams. Calls must be serialized because root flags and other invocation state are process-wide.
Types ¶
This section is empty.