shared

package
v14.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCheckoutOpcode

func IsCheckoutOpcode(opcode Opcode) bool

func IsEndOfBranchProgramOpcode

func IsEndOfBranchProgramOpcode(opcode Opcode) bool

Types

type Opcode

type Opcode interface {
	// CreateAbortProgram provides the opcodes to abort this Opcode when it encounters an error.
	CreateAbortProgram() []Opcode

	// CreateContinueProgram provides the opcodes continue this opcode
	// after it encountered an error and the user has resolved the error.
	CreateContinueProgram() []Opcode

	// CreateAutomaticUndoError provides the error message to display when this opcode
	// cause the command to automatically undo.
	CreateAutomaticUndoError() error

	// Run executes this opcodes.
	Run(args RunArgs) error

	// ShouldAutomaticallyUndoOnError indicates whether this opcode should
	// cause the command to automatically undo if it errors.
	// When true, automatically runs the abort and undo logic and leaves the user where they started.
	// When false, stops execution to let the user fix the issue and continue or manually undo.
	ShouldAutomaticallyUndoOnError() bool
}

Opcode is an atomic operation that the Git Town interpreter can execute. Opcodes implement the command pattern (https://en.wikipedia.org/wiki/Command_pattern) and provide opcodes to continue and abort them. Undoing an opcode is done via the undo package.

type RunArgs

type RunArgs struct {
	Connector                       hostingdomain.Connector
	DialogTestInputs                *components.TestInputs
	Lineage                         configdomain.Lineage
	PrependOpcodes                  func(...Opcode)
	RegisterUndoablePerennialCommit func(gitdomain.SHA)
	Runner                          *git.ProdRunner
	UpdateInitialBranchLocalSHA     func(gitdomain.LocalBranchName, gitdomain.SHA) error
}

Jump to

Keyboard shortcuts

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