operation

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupExitCleanup

func SetupExitCleanup(w io.Writer, operation Operation, exit func(int)) func() []logger.Entry

SetupExitCleanup sets up a handler to run an operation once when the program exits due to an interrupt signal.

Types

type Conditional

type Conditional struct {
	// contains filtered or unexported fields
}

func (*Conditional) Description

func (c *Conditional) Description() string

func (*Conditional) DryRun

func (c *Conditional) DryRun(output io.Writer) error

func (*Conditional) Run

func (c *Conditional) Run(cmdOutput io.Writer) error

type Operation

type Operation interface {
	Description() string
	Run(cmdOutput io.Writer) error
	DryRun(output io.Writer) error
}

func NewConditional

func NewConditional(condition Predicate, ifTrue Operation, ifFalse Operation) Operation

type Predicate

type Predicate interface {
	Eval() bool
}

type Sequence

type Sequence []Operation

func NewSequence

func NewSequence(operations ...Operation) Sequence

func (Sequence) DryRun

func (s Sequence) DryRun(output io.Writer) error

func (Sequence) Run

func (s Sequence) Run(cmdOutput io.Writer) error

Jump to

Keyboard shortcuts

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