cmd

package
v1.260419.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
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

	// HTTP 4xx range: 10 + (status - 400)
	// Note: 404 and 409 are mapped to ExitNotFound and ExitConflict above.
	ExitHTTPBadRequest    = 10 // 400
	ExitHTTPUnauthorized  = 11 // 401
	ExitHTTPForbidden     = 12 // 403
	ExitHTTPUnprocessable = 22 // 422

	// HTTP 5xx range: 60 + (status - 500)
	ExitHTTPInternalServer     = 60 // 500
	ExitHTTPBadGateway         = 62 // 502
	ExitHTTPServiceUnavailable = 63 // 503
)

Exit codes following the CI/CD specification.

Variables

This section is empty.

Functions

func APIErrorCodeToExitCode

func APIErrorCodeToExitCode(code string) int

APIErrorCodeToExitCode maps an API error code string to the appropriate exit code.

func ExitCodeFromError

func ExitCodeFromError(err error) int

ExitCodeFromError maps an error to the appropriate exit code. This is the single source of truth for exit code determination.

func HTTPStatusToExitCode

func HTTPStatusToExitCode(status int) int

HTTPStatusToExitCode maps an HTTP status code to the appropriate exit code.

func RootCommand

func RootCommand(version string) *ffcli.Command

RootCommand returns the root command

func RootUsageFunc

func RootUsageFunc(c *ffcli.Command) string

RootUsageFunc renders grouped root help, similar to gh style.

func Run

func Run(args []string, versionInfo string) int

Run executes the CLI using the provided args (not including argv[0]) and version string. It returns the intended process exit code.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL