cli

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package cli wires Cobra commands to sqio services and terminal I/O.

Index

Constants

View Source
const (
	// ExitSuccess indicates successful command completion.
	ExitSuccess = 0
	// ExitInternal indicates an internal, configuration, input, or output error.
	ExitInternal = 1
	// ExitSQLSyntax indicates rejected SQL or lint issues.
	ExitSQLSyntax = 2
	// ExitConnection indicates database connection setup failure.
	ExitConnection = 3
	// ExitTimeout indicates command execution exceeded its timeout.
	ExitTimeout = 4
	// ExitCancelled indicates command execution was cancelled by the user.
	ExitCancelled = 5
)

Variables

This section is empty.

Functions

func Execute

func Execute() error

Execute builds and runs the root command with signal-aware context handling.

func ExitCode

func ExitCode(err error) int

ExitCode maps an error to sqio's process exit code convention.

func StructuredError

func StructuredError(err error) string

StructuredError formats err as a compact JSON object for stderr output.

Types

type CommandError

type CommandError struct {
	Type     string
	Message  string
	Position int
	Code     int
}

CommandError carries a machine-readable error type and process exit code.

func (*CommandError) Error

func (e *CommandError) Error() string

Error returns the user-facing error message.

Jump to

Keyboard shortcuts

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