cli

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 50 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 maps loupe's commands onto cobra and turns domain results and refusals into the output contract.

Index

Constants

View Source
const DefaultReleases = "https://github.com/secondshift-labs/loupe/releases"

DefaultReleases is where loupe's releases download from.

View Source
const WarnUpdateAvailable = "update-available"

WarnUpdateAvailable is the warning code a capture result carries when a newer loupe release exists.

View Source
const WarnWithdrawReasonMissing = "withdraw-reason-missing"

WarnWithdrawReasonMissing is the warning code an edit result carries when an agent withdrew a finding without saying why.

Variables

This section is empty.

Functions

func ConflictsWithFrom

func ConflictsWithFrom(cmd *cobra.Command, flags ...string) error

ConflictsWithFrom refuses when --from is combined with any flag that sets the same content.

func DecodeInput

func DecodeInput(command, from string, stdin io.Reader, v any) error

DecodeInput reads JSON from the file at from, or from stdin when from is "-".

func Execute

func Execute(deps Deps, args []string) int

func NewRoot

func NewRoot(deps Deps) *cobra.Command

func OpenURL

func OpenURL(goos string) func(url string) error

OpenURL opens a URL with the handler of the platform goos names. Its output goes nowhere, so a browser it starts cannot hold a pipe open and keep the wait from returning.

Types

type Deps

type Deps struct {
	// Context ends a command that waits; nil means Background.
	Context context.Context
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
	Getenv  func(string) string
	Now     func() time.Time
	WorkDir string
	// GitHub is a func so commands that never talk to GitHub never build a client or read credentials.
	GitHub     func() (github.Client, error)
	IsTerminal func() bool
	// StderrIsTerminal is consulted only under --json, where human-only commands draw on stderr.
	StderrIsTerminal func() bool
	// TermWidth is the terminal width human output wraps to; nil means the default of 80 columns.
	TermWidth func() int
	// TTYWidth is the agent's own terminal width, which picks a handoff's split direction; nil means unreadable.
	TTYWidth func() (int, bool)
	// GOOS is the operating system a handoff detects hosts on; empty is not macOS, so no test meets a macOS-only host.
	GOOS string
	// OpenURL opens a published review in the browser; nil means review offers no way to.
	OpenURL func(string) error
	// LockBusy, when set, runs each time capture finds its lock held; tests use it to know a second capture is waiting.
	LockBusy func()
	// Version, when set, replaces the version stamped into the build, so that a test can act as a release.
	Version string
	// Releases, when set, replaces DefaultReleases, so that update and uninstall download from a test's server.
	Releases string
	// Executable finds the running binary for update and uninstall; nil means os.Executable.
	Executable func() (string, error)
	// Screen, when set, is a test's stand-in for the terminal review and publish draw on; see tui.Screen.
	Screen *tui.Screen
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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