exitcode

package
v0.10.257 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package exitcode centralizes cr's command-layer process exit taxonomy.

Index

Constants

View Source
const (
	// Success means the program completed successfully.
	Success = 0
	// Failure is the generic non-usage failure code.
	Failure = 1
	// UsageError means command syntax, flags, or arguments were invalid.
	UsageError = 2
	// AuthConfigError means authentication or configuration prevented execution.
	AuthConfigError = 3
	// UpstreamError means an upstream service or network failure prevented execution.
	UpstreamError = 5
)

Variables

This section is empty.

Functions

func AuthConfig

func AuthConfig(err error) error

AuthConfig marks err as an authentication or configuration error.

func ExactArgs added in v0.10.228

func ExactArgs(n int, msg string) cobra.PositionalArgs

ExactArgs requires exactly n positional arguments.

func FromError

func FromError(err error) int

FromError maps an error to cr's process exit taxonomy.

func MaximumArgs added in v0.10.228

func MaximumArgs(n int, msg string) cobra.PositionalArgs

MaximumArgs allows at most n positional arguments.

func NoArgs added in v0.10.228

func NoArgs(msg string) cobra.PositionalArgs

NoArgs rejects any positional arguments with the given usage message.

func NoArgsf added in v0.10.228

func NoArgsf(format string) cobra.PositionalArgs

NoArgsf rejects any positional arguments, formatting the message with the first argument.

func NonEmptyArg added in v0.10.228

func NonEmptyArg(msg string) cobra.PositionalArgs

NonEmptyArg requires a single non-empty positional argument.

func RangeArgs added in v0.10.228

func RangeArgs(minimum, maximum int, msg string) cobra.PositionalArgs

RangeArgs requires between minimum and maximum positional arguments inclusive.

func Upstream

func Upstream(err error) error

Upstream marks err as an upstream or network error.

func Usage

func Usage(err error) error

Usage marks err as a usage error.

func With

func With(code int, err error) error

With wraps err with an explicit process exit code. Nil stays nil so callers can safely write `return exitcode.With(..., err)`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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