Documentation
¶
Index ¶
- Constants
- func FilterMessages(items []listItem, opts FilterOptions) []listItem
- func GetExitCode(err error) int
- func NotFoundError(format string, args ...any) error
- func Run(args []string) error
- func TimeoutError(format string, args ...any) error
- func UsageError(format string, args ...any) error
- func WithExitCode(code int, err error) error
- type ExitCodeError
- type FilterOptions
Constants ¶
View Source
const ( // ExitSuccess indicates the command completed successfully. ExitSuccess = 0 // ExitError indicates a general error occurred. ExitError = 1 // ExitUsage indicates invalid arguments or flags were provided. ExitUsage = 2 // ExitNotFound indicates a requested resource was not found // (message, config, agent, etc.). ExitNotFound = 3 // ExitTimeout indicates a timeout occurred (watch, monitor commands). ExitTimeout = 4 )
Exit codes for CLI commands. These provide semantic meaning for scripting and automation.
Variables ¶
This section is empty.
Functions ¶
func FilterMessages ¶ added in v0.9.6
func FilterMessages(items []listItem, opts FilterOptions) []listItem
FilterMessages returns items that match all provided filter options.
func GetExitCode ¶ added in v0.9.6
GetExitCode extracts the exit code from an error. Returns ExitSuccess (0) if err is nil. Returns the wrapped code if err is an *ExitCodeError. Returns ExitError (1) for all other errors.
func NotFoundError ¶ added in v0.9.6
NotFoundError creates an error with ExitNotFound code.
func TimeoutError ¶ added in v0.9.6
TimeoutError creates an error with ExitTimeout code.
func UsageError ¶ added in v0.9.6
UsageError creates an error with ExitUsage code.
func WithExitCode ¶ added in v0.9.6
WithExitCode wraps an error with a specific exit code.
Types ¶
type ExitCodeError ¶ added in v0.9.6
ExitCodeError wraps an error with a specific exit code.
func (*ExitCodeError) Error ¶ added in v0.9.6
func (e *ExitCodeError) Error() string
func (*ExitCodeError) Unwrap ¶ added in v0.9.6
func (e *ExitCodeError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.