shell

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExecDriverName is the name of exec-driver
	ExecDriverName = "shell"
)

Variables

This section is empty.

Functions

func BuildScript

func BuildScript(t *hm.Task) string

BuildScript generates script file according to cmds/script in target

func BuildScriptFile

func BuildScriptFile(t *hm.Task) (string, error)

BuildScriptFile generates the script file using default generated script

func Factory

func Factory(task *hm.Task) (hm.Runner, error)

Factory is runner factory

func LogFile

func LogFile(t *hm.Task) string

LogFile returns the fullpath to log filename

func ScriptFile

func ScriptFile(t *hm.Task) string

ScriptFile returns the filename of script

func WriteScriptFile

func WriteScriptFile(t *hm.Task, script string) error

WriteScriptFile builds the script file with provided script

Types

type Args added in v1.1.0

type Args struct {
	Args []string
}

Args build arguments

func NewArgs added in v1.1.0

func NewArgs(args ...string) *Args

NewArgs creates Args

func (*Args) Add added in v1.1.0

func (a *Args) Add(args ...string) *Args

Add appends arguments

type Command

type Command struct {
	Shell string                 `map:"*"`
	Ext   map[string]interface{} `map:"*"`
}

Command defines a single command to execute

type Executor

type Executor struct {
	Task        *hm.Task
	Cmd         *exec.Cmd
	Console     bool
	Stdout      bool
	Stderr      bool
	LogToTask   bool
	LogFileName string
}

Executor wraps over exec.Cmd with output file

func Exec

func Exec(t *hm.Task, command string, args ...string) *Executor

Exec executes an external command for a task

func ExecScript

func ExecScript(t *hm.Task) *Executor

ExecScript executes generated script

func (*Executor) AddArgs added in v1.1.0

func (x *Executor) AddArgs(args ...string) *Executor

AddArgs appends more arguments

func (*Executor) LogTo added in v1.3.0

func (x *Executor) LogTo(filename string) *Executor

LogTo overrides log file name

func (*Executor) Mute

func (x *Executor) Mute() *Executor

Mute disables the output

func (*Executor) MuteErr added in v1.1.0

func (x *Executor) MuteErr() *Executor

MuteErr disables the stderr

func (*Executor) MuteOut added in v1.1.0

func (x *Executor) MuteOut() *Executor

MuteOut disables the stdout

func (*Executor) MuteTask added in v1.3.0

func (x *Executor) MuteTask() *Executor

MuteTask stop sending output to task

func (*Executor) Run

func (x *Executor) Run(sigCh <-chan os.Signal) (err error)

Run starts the executor

type Runner

type Runner struct {
	Task *hm.Task
}

Runner is shell runner

func (*Runner) Run

func (r *Runner) Run(sigCh <-chan os.Signal) (hm.TaskResult, error)

Run implements Runner

func (*Runner) Signature added in v1.1.0

func (r *Runner) Signature() string

Signature implements Runner

func (*Runner) ValidateArtifacts added in v1.1.0

func (r *Runner) ValidateArtifacts() bool

ValidateArtifacts implements Runner

type Target

type Target struct {
	Console bool       `map:"console"`
	Env     []string   `map:"env"`
	Cmds    []*Command `map:"cmds"`
	Script  string     `map:"script"`
}

Target defines the schema of shell commands in target

Jump to

Keyboard shortcuts

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