cli

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Overview

Package cli implements the sonde command line: cobra commands, flag mapping and output wiring. It returns exit codes and never exits itself.

Index

Constants

View Source
const (
	ExitOK          = 0   // success
	ExitUsage       = 1   // CLI usage / option error
	ExitParse       = 2   // input file parse error (also unreadable input file)
	ExitRuntime     = 3   // runtime error: connect, TLS, timeout, sandbox denial, unsupported option
	ExitAssert      = 4   // assert / contract failure
	ExitUndefined   = 127 // undefined error, e.g. a report cannot be written
	ExitInterrupted = 130 // interrupted (Ctrl-C)
)

Process exit codes (docs/architecture.md §5), including the documented ExitInterrupted.

Variables

This section is empty.

Functions

func Execute

func Execute() int

Execute runs sonde with the process arguments and returns the exit code. Ctrl-C is two-stage, matching the upstream CLI: the first SIGINT stops scheduling new files and lets running ones finish their current entry; if a second SIGINT arrives, or ctrlCGrace elapses first, in-flight requests are aborted too. Either way the run then exits 130.

Types

type ExitError

type ExitError struct {
	Code int
	Err  error
}

ExitError attaches a process exit code to an error. Commands wrap every error that must not map to ExitUsage.

func NewExitError

func NewExitError(code int, err error) *ExitError

NewExitError wraps err with the given exit code.

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) Unwrap

func (e *ExitError) Unwrap() error

Jump to

Keyboard shortcuts

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