cli

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package cli builds the fxvcs command tree. Commands are presentation adapters: they parse flags, call a typed SDK operation, render the result (human or --json), and choose an exit code. No business logic lives here.

Index

Constants

View Source
const (
	ExitOK              = 0
	ExitFailure         = 1
	ExitUsage           = 2
	ExitUpgradeRequired = 3
	ExitNotImplemented  = 4
	ExitBusy            = 5
)

Exit codes are part of the automation contract.

Variables

This section is empty.

Functions

func New

func New(env Env) *cli.Command

New builds the root command.

func Run

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

Run executes the app and maps errors to exit codes. It never panics on SDK errors and never prints secrets.

func Verbatim

func Verbatim(err error) error

Verbatim wraps err so Run prints it word for word (nil stays nil).

Types

type Env

type Env struct {
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader
	// Getwd resolves the working directory (defaults to os.Getwd).
	Getwd func() (string, error)
	// IsTerminal decides whether a writer is an interactive terminal
	// (defaults to a character-device check). Tests set it to force the
	// live-progress and colour paths on.
	IsTerminal func(io.Writer) bool
	// Extra registers additional top-level commands (filter/diff/merge drivers,
	// spikes) supplied by other packages so this package has no dependency on
	// their engines.
	Extra []*cli.Command
}

Env carries process I/O so tests can drive the app without a real terminal.

type VerbatimError

type VerbatimError struct{ Err error }

VerbatimError marks an error whose message must reach the user unchanged (Git-facing driver output, whose wording other tooling may match).

func (VerbatimError) Error

func (e VerbatimError) Error() string

Error returns the wrapped message.

func (VerbatimError) Unwrap

func (e VerbatimError) Unwrap() error

Unwrap exposes the wrapped error for errors.Is/As.

Directories

Path Synopsis
Package drivers registers the Git process-boundary entry points (filter-process, diff-driver, merge-driver) and spike commands with the CLI.
Package drivers registers the Git process-boundary entry points (filter-process, diff-driver, merge-driver) and spike commands with the CLI.
ui
Package ui is the presentation layer of the fxvcs CLI: headers, footers, aligned tables, item rows with a state word (and an optional symbol on a terminal), hints, byte formatting, and plural helpers.
Package ui is the presentation layer of the fxvcs CLI: headers, footers, aligned tables, item rows with a state word (and an optional symbol on a terminal), hints, byte formatting, and plural helpers.
live
Package live is the interactive progress view: a bounded, in-place display of an operation that touches many files.
Package live is the interactive progress view: a bounded, in-place display of an operation that touches many files.

Jump to

Keyboard shortcuts

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