command

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package command implements creator and executor interface to create a command executor that can execute any command line commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Creator

type Creator struct{}

Creator that can create a command executor

func (*Creator) CanCreate

func (c *Creator) CanCreate(hook *config.Hook) bool

CanCreate checks if this creator can create executor for hook. Will check if hook has a command definition.

func (*Creator) Create

func (c *Creator) Create(hook *config.Hook) (def.Executor, error)

Create a new executor for hook.

type Executor

type Executor struct {
	Command    string
	Arguments  []string
	WorkingDir string
	// contains filtered or unexported fields
}

Executor can execute a command

func (*Executor) HasRun

func (e *Executor) HasRun() bool

HasRun checks if command has already run

func (*Executor) Output

func (e *Executor) Output() string

Output returns output string once command has been executed. If command has not been executed it will always return empty string.

func (*Executor) Run

func (e *Executor) Run(env map[string]string) error

Run the command and store result in output

Jump to

Keyboard shortcuts

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