instruction

package
v0.0.0-...-5998bd7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotSet = fmt.Errorf("cannot set the field")

ErrCannotSet is raised when there is an error trying to update a field

View Source
var ErrInvalidAlias = fmt.Errorf("invalid alias name (contains '/')")

ErrInvalidAlias is raised when encountering an invalid token in an alias name

View Source
var ErrInvalidSyntax = fmt.Errorf("invalid instruction format")

ErrInvalidSyntax is raised when encountering an invalid token

View Source
var ErrUnknownInstruction = fmt.Errorf("unknown instruction")

ErrUnknownInstruction is raised when encountering an unknown instruction it can mean that you're not using the right version or that you've misspelled it

Functions

This section is empty.

Types

type ExecutionContext

type ExecutionContext struct {
	PackageManager pkg.PackageManager
	ServiceManager ser.ServiceManager
	Executor       exec.Executor
	Alias          map[string]string
}

ExecutionContext contains system-specific drivers to manage the host

func CreateContext

func CreateContext(_pkg, _ser string, _exec ...exec.Executor) (*ExecutionContext, error)

CreateContext creates an execution contet with the given package-manager and service-manager default values are taken from each go package (pkg, ser) if _exec is set, it will override the default (os) executor

type FileError

type FileError struct {
	Reason string
	File   string
	Err    error
}

FileError is used for file-specific errors

func (FileError) Error

func (ce FileError) Error() string

type T

type T interface {
	// Raw input line
	Raw() string
	// Build the instruction with input arguments
	Build(string) error
	// Exec the given instruction
	Exec(ExecutionContext) ([]byte, error)
	// DryRun checks the success of the given instruction without actually running it (non-destructive)
	DryRun(ExecutionContext) ([]byte, error)
}

T is the instruction common interface

func Parse

func Parse(raw string) (T, error)

Parse from a raw line

Jump to

Keyboard shortcuts

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