Documentation
¶
Overview ¶
Package cli implements the Cobra command tree for iserv-cli, supporting both scriptable non-interactive subcommands and the interactive Bubble Tea TUI.
Index ¶
Constants ¶
const ( ExitOK = 0 ExitError = 1 ExitUsage = 2 ExitInterrupt = 130 )
Exit codes following POSIX / Go CLI conventions.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute(ctx context.Context, args []string, deps Dependencies) error
Execute runs the CLI with ctx and returns any execution error without exiting the process.
func NewRootCmd ¶
func NewRootCmd(deps Dependencies) *cobra.Command
NewRootCmd constructs a fresh, isolated root *cobra.Command tree.
Types ¶
type Dependencies ¶
type Dependencies struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Connect client.ConnectFunc
LoadSaved func() config.SavedConfig
SaveSaved func(config.SavedConfig) error
RunTUI func(ctx context.Context, cfg config.AppConfig, saved config.SavedConfig, connect client.ConnectFunc, saveFn func(config.SavedConfig) error) error
DefaultCfgDir string
}
Dependencies injects external boundaries (I/O, SDK factory, config persistence, TUI runner) into NewRootCmd for clean testing and zero global state.
type HealthProbe ¶
type HealthProbe struct {
Module string `json:"module"`
Status string `json:"status"`
LatencyMS int64 `json:"latency_ms"`
Detail string `json:"detail"`
}
HealthProbe reports connectivity, item count, and latency for a single IServ module.
type UsageError ¶
type UsageError struct {
Err error
}
UsageError marks invalid CLI arguments or missing required credentials (exit code 2).
func (*UsageError) Error ¶
func (e *UsageError) Error() string
Error implements the error interface.
func (*UsageError) Unwrap ¶
func (e *UsageError) Unwrap() error
Unwrap returns the underlying usage error.