Documentation
¶
Index ¶
Constants ¶
const ( ExitOK = 0 ExitError = 1 ExitUsage = 2 ExitAuth = 4 ExitNotFound = 5 ExitCancel = 8 )
Exit codes. Keep in sync with sdk/corecmd/topics/exit-codes.txt and sdk/skills/SKILL.md.tmpl.
Variables ¶
var ErrCancel = &Error{Exit: ExitCancel, Code: "cancelled", Message: "cancelled"}
ErrCancel is returned when the user aborts an operation.
Functions ¶
Types ¶
type Error ¶
type Error struct {
Exit int `json:"-"`
Code string `json:"code"`
Message string `json:"message"`
Hint string `json:"hint,omitempty"`
Err error `json:"-"`
// Silent means the command already reported the problem; only the exit code matters.
Silent bool `json:"-"`
}
Error is a user-facing error with a stable machine-readable code and an optional hint.
func FlagErrorf ¶
FlagErrorf reports invalid usage (exit code 2).
func NoInputError ¶
NoInputError is returned when a value is required but prompting is not possible.
func SilentExit ¶
SilentExit returns an error that only sets the exit code.