cmd

package
v2.2.6 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 20 Imported by: 1 module, 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 cmd is preen's command line surface. It parses arguments, wires the engine, and renders results; every decision and guardrail lives in the engine packages so the CLI stays a thin shell over them.

Index

Constants

View Source
const (
	// CodeOK means the run completed, or help or version was served.
	CodeOK = 0
	// CodeErr covers failures with no more specific code.
	CodeErr = 1
	// CodeNoRepo means the working directory is not inside a git repository.
	CodeNoRepo = 2
	// CodeRepoState means a rebase, merge, or cherry-pick is in progress.
	CodeRepoState = 3
	// CodeNothingToDo means the tree was clean and nothing needed redoing.
	CodeNothingToDo = 4
	// CodeInvalidPlan means the plan did not account for the tree exactly once,
	// or a --grouping answer was stale or named something not in the tree.
	CodeInvalidPlan = 5
	// CodeGateFailed means the gate command failed and the run was rolled back.
	CodeGateFailed = 6
	// CodeContentChanged means the conservation check failed and the run was
	// rolled back. It is the code that should never appear.
	CodeContentChanged = 7
	// CodeAborted means the user declined the plan.
	CodeAborted = 8
)

Exit codes. Each failure mode gets its own code so a script can tell a rolled-back run from a rejected plan without parsing output.

Variables

View Source
var (
	// ErrUsage reports invalid arguments.
	ErrUsage = errors.New("invalid arguments")
	// ErrAborted reports that the user declined the plan, which is a normal
	// outcome rather than a failure worth a message.
	ErrAborted = errors.New("aborted")
	// ErrNoBackups reports that no recovery ref exists to restore from.
	ErrNoBackups = errors.New("no preen backups in this repository")
)

Sentinel errors for the command line surface.

View Source
var Version = ""

Version is the CLI version, set by the release build with -ldflags "-X github.com/dcadolph/preen/v2/cmd.Version=<v>". When it is empty, version falls back to the module version go install records.

Functions

func Execute

func Execute(args []string) int

Execute runs preen with the given arguments and returns a process exit code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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