workflow

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Phase

type Phase struct {
	// Name is the name of the phase
	Name string

	// Aliases are alternative names for the phase
	Aliases []string

	// Description is the description of the phase
	Description string

	// PreRun is the function to run before the phase
	PreRun func(data RunData) error

	// Run is the function to run the phase
	Run func(ctx context.Context, data RunData) error

	// Flags is the list of flags to add to the command
	// when it is run as an individual phase
	Flags []string
}

Phase is a single phase of the workflow.

type RunData

type RunData = interface{}

RunData contains the data that is passed to the phases

type Runner

type Runner interface {
	// AppendPhases adds a number of phases to the list of phases to run
	AppendPhases(phases ...Phase)

	// AppendSkipPhases adds a number of phases to the list of phases to skip
	AppendSkipPhases(phases ...Phase)

	// IsPhaseActive returns true if the phase is active
	IsPhaseActive(phase Phase) bool

	// BindToCommand alters the command's help text and flags to include the phase's flags
	BindToCommand(cmd *cobra.Command, data RunData)

	// Run runs the phases except the ones specified in skipPhases
	Run(data RunData) error
}

Runner is the interface for running phases

func NewPhaseRunner

func NewPhaseRunner() Runner

NewRunner returns a new instance of the runner

Jump to

Keyboard shortcuts

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