cli

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 37 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cli implements the acd-ctx command line (spec §18.7, §19.8). Every command is a function of its arguments, its streams and its environment, so tests drive it without a process. cmd/acd-ctx calls Run.

Index

Constants

View Source
const (
	ExitOK    = 0
	ExitFail  = 1
	ExitUsage = 2
)

Exit codes. ExitUsage is for malformed command lines.

Variables

This section is empty.

Functions

func Run

func Run(args []string, streams IO) int

Run executes one acd-ctx command line (args without the program name) and returns the process exit code.

func Usage

func Usage() string

Usage describes the command line.

Types

type IO

type IO struct {
	// Ctx stops long-running commands (mcp). Nil means context.Background.
	Ctx context.Context
	// Stdin is read by confirmations and by the MCP server.
	Stdin io.Reader
	// Stdout carries command output and the MCP protocol.
	Stdout io.Writer
	// Stderr carries diagnostics, warnings, prompts and client logs.
	Stderr io.Writer
	// LookupEnv reads environment variables (ACD_CTX_*, XDG_*, HOME). Nil
	// means os.LookupEnv.
	LookupEnv func(key string) (string, bool)
	// Cwd is the working directory used for project detection. Empty means
	// the process working directory.
	Cwd string
	// Version is reported to the proxy and to MCP clients.
	Version string
}

IO carries the streams and environment of one invocation. Zero fields take the process defaults; Stdin, Stdout and Stderr default to empty or discarded streams, so pass os.Stdin and friends from main.

Jump to

Keyboard shortcuts

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