cli

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitOK       = 0
	ExitError    = 1
	ExitUsage    = 2
	ExitNotFound = 3
)

Variables

This section is empty.

Functions

func EncodeJSON

func EncodeJSON(w io.Writer, v any) error

func IsTerminal

func IsTerminal() bool

func WriteError

func WriteError(w io.Writer, format Format, e *CLIError)

Types

type CLIError

type CLIError struct {
	Code        string   `json:"code"`
	Message     string   `json:"message"`
	Suggestions []string `json:"suggestions,omitempty"`
	ExitCode    int      `json:"exit_code"`
	Retryable   bool     `json:"retryable,omitempty"`
}

func Err

func Err(code, message string) *CLIError

func ErrWithExit

func ErrWithExit(code, message string, exitCode int) *CLIError

func (*CLIError) Error

func (e *CLIError) Error() string

type Format

type Format string
const (
	FormatTable Format = "table"
	FormatJSON  Format = "json"
)

func ResolveFormat

func ResolveFormat(flag string, jsonFlag bool) Format

Jump to

Keyboard shortcuts

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