shared

package
v11.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCheckoutOpcode

func IsCheckoutOpcode(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 opcode.
	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 {
	PrependOpcodes                  func(...Opcode)
	Connector                       hosting.Connector
	Lineage                         config.Lineage
	RegisterUndoablePerennialCommit func(domain.SHA)
	Runner                          *git.ProdRunner
	UpdateInitialBranchLocalSHA     func(domain.LocalBranchName, domain.SHA) error
}

Jump to

Keyboard shortcuts

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