sudo

package
v0.6.322 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedGater

type CachedGater struct{}

CachedGater is a Gater that always acts as if sudo is cached (no prompt, no refresh). For tests.

func (CachedGater) Gate

type Gater

type Gater interface {
	Gate(t *terminal.Terminal, confirmer terminal.Confirmer, reason string, assumeYes bool) error
}

Gater gates execution on sudo availability; callers can use Default or inject a stub in tests.

var Default Gater = &systemGater{}

Default is the Gater used by commands. Tests may replace it with a stub.

type Status

type Status int

Status represents the current sudo/root status of the process.

const (
	// StatusRoot means the process is already running as root.
	StatusRoot Status = 0
	// StatusCached means the user has a valid sudo timestamp (no password needed).
	StatusCached Status = 1
	// StatusUncached means sudo will require a password prompt.
	StatusUncached Status = 2
)

Jump to

Keyboard shortcuts

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