cli

package
v0.57.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 47 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

	// ExitContextMismatch indicates a valid command was blocked because its
	// resolved mailbox root conflicts with the pinned AMQ session context.
	ExitContextMismatch = 5
)

Exit codes for CLI commands. These provide semantic meaning for scripting and automation.

Variables

This section is empty.

Functions

func ContextMismatchError added in v0.42.1

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

ContextMismatchError creates an error with ExitContextMismatch code.

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, version 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 CommandHandler added in v0.23.0

type CommandHandler func([]string) error

CommandHandler is the function signature for command handlers in the registry.

type CommandInfo added in v0.23.0

type CommandInfo struct {
	Name            string
	Summary         string
	Description     string
	LongDescription []string
	Examples        []string
	Footer          string
	Handler         CommandHandler
	Children        []CommandInfo
}

CommandInfo describes a top-level command or subcommand for help generation and future routing/completion work.

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.

type SessionContextError added in v0.42.1

type SessionContextError struct {
	Message string
}

SessionContextError identifies an unsafe or incoherent mailbox context. It is distinct from a usage error: the command syntax was valid.

func (*SessionContextError) Error added in v0.42.1

func (e *SessionContextError) Error() string

type TreeRelation added in v0.44.0

type TreeRelation uint8

TreeRelation is a physical-filesystem relationship. Unknown is deliberately distinct from Different: callers must choose whether unverifiable identity is advisory or authority-bearing instead of accidentally collapsing failures.

const (
	TreeRelationUnknown TreeRelation = iota
	TreeRelationSame
	TreeRelationDifferent
)

func (TreeRelation) String added in v0.44.0

func (r TreeRelation) String() string

Source Files

Jump to

Keyboard shortcuts

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