cli

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package cli implements the aboard command: it parses arguments, talks to an Aboard server through its public API, keeps this machine's agent credentials and project settings on disk, and prints results as text or as one JSON object.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, args []string, env Env) int

Run runs the aboard command with args (without the program name) and returns the process exit code.

func TrustCertFile

func TrustCertFile(getenv func(string) string) error

TrustCertFile makes every HTTPS request this process sends trust the PEM certificates in SSL_CERT_FILE as well as the system's roots, on every platform: Go reads that variable on Linux but not on macOS. A team server whose certificate comes from a team's own authority is then reachable from either. With the variable unset it changes nothing. Call it once, before any request.

Types

type Env

type Env struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
	// Getenv reads an environment variable.
	Getenv func(string) string
	// Dir is the working directory, where the project's .aboard file lives.
	Dir string
	// Executable returns the path of the running aboard binary, used to start the
	// local server in the background.
	Executable func() (string, error)
	// Rand is the source of randomness for idempotency keys.
	Rand io.Reader
	// Terminal is true when standard input and output are a terminal, so a command may
	// ask questions.
	Terminal bool
	// StdoutTerminal and StderrTerminal are true when that stream is a terminal, so text
	// written to it may be colored.
	StdoutTerminal, StderrTerminal bool
	// OpenBrowser opens a URL in the person's browser, failing when no browser could be
	// started.
	OpenBrowser func(ctx context.Context, url string) error
}

Env is everything a command reads from or writes to the outside world.

func OSEnv

func OSEnv() Env

OSEnv returns the environment of the running process.

type Error

type Error struct {
	Code    string
	Message string
	Hint    string
	Details map[string]any
	// Exit is the process exit code; zero means exitError.
	Exit int
	// Usage is printed to stderr after the error, for usage errors.
	Usage string
	// Err is the underlying cause, if any. It is never shown to the user as is.
	Err error
}

Error is a failure reported to the person or agent running a command. It has the same fields as an API error, so errors from the server pass through unchanged.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

Jump to

Keyboard shortcuts

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