cli

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

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

func GetExitCode(err error) int

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

func NotFoundError(format string, args ...any) error

NotFoundError creates an error with ExitNotFound code.

func Run

func Run(args []string) error

func TimeoutError added in v0.9.6

func TimeoutError(format string, args ...any) error

TimeoutError creates an error with ExitTimeout code.

func UsageError added in v0.9.6

func UsageError(format string, args ...any) error

UsageError creates an error with ExitUsage code.

func WithExitCode added in v0.9.6

func WithExitCode(code int, err error) error

WithExitCode wraps an error with a specific exit code.

Types

type ExitCodeError added in v0.9.6

type ExitCodeError struct {
	Code int
	Err  error
}

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

type FilterOptions added in v0.9.6

type FilterOptions struct {
	Priority string
	From     string
	Kind     string
	Labels   []string
}

FilterOptions defines filter criteria for listing messages.

Jump to

Keyboard shortcuts

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