cli

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitCodeOK          = 0
	ExitCodeGeneral     = 1 // unexpected error
	ExitCodeAuth        = 2 // authentication/authorization failure
	ExitCodeNetwork     = 3 // network/connection error
	ExitCodeBadInput    = 4 // invalid input, missing file, bad flag
	ExitCodeTimeout     = 5 // operation timed out
	ExitCodeUnavailable = 6 // resource not found or unavailable
)

Exit codes for semantic error signaling to AI agents and automation.

Variables

View Source
var Version string

Functions

func AgentDefaults

func AgentDefaults() map[string]interface{}

AgentDefaults returns a set of flag overrides for --agent mode. This reduces the flag boilerplate agents need to pass.

func ExitCode

func ExitCode(err error) int

ExitCode returns the exit code for the error.

func OutputVersion

func OutputVersion(version, commit, goVersion, buildDate string, outputFmt string)

OutputVersion writes version info. Supports --json format.

func Run

func Run() (err error)

func SetJSONLogging

func SetJSONLogging()

SetJSONLogging enables JSON-structured log output. Pass "--log-format json" to the CLI to enable.

Types

type JSONError

type JSONError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

JSONError carries structured error information.

type JSONResult

type JSONResult struct {
	Status string      `json:"status"`          // "ok" or "error"
	Data   interface{} `json:"data,omitempty"`  // command-specific payload
	Error  *JSONError  `json:"error,omitempty"` // error details on failure
}

JSONResult is the standard JSON envelope for all command output. Every command that supports --output json wraps its result in this struct.

type TabComplete

type TabComplete struct{}

func (TabComplete) Do

func (t TabComplete) Do(line []rune, pos int) ([][]rune, int)

Jump to

Keyboard shortcuts

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