cmdexec

package
v0.0.0-...-4a142f4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2018 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTempFile

func NewTempFile() (*os.File, error)

func NewTempFileName

func NewTempFileName(extension string) string

Types

type Arguments

type Arguments map[string]interface{}

Arguments for command execution

func NewArguments

func NewArguments() Arguments

creates a new empty set of arguments

func (Arguments) SetBoolean

func (args Arguments) SetBoolean(name string, value bool) Arguments

func (Arguments) SetFloat32

func (args Arguments) SetFloat32(name string, value float32) Arguments

func (Arguments) SetFloat64

func (args Arguments) SetFloat64(name string, value float64) Arguments

func (Arguments) SetInt32

func (args Arguments) SetInt32(name string, value int32) Arguments

func (Arguments) SetInt64

func (args Arguments) SetInt64(name string, value int64) Arguments

func (Arguments) SetString

func (args Arguments) SetString(name string, value string) Arguments

save new argument into list of arguments

func (Arguments) SetUInt32

func (args Arguments) SetUInt32(name string, value uint32) Arguments

func (Arguments) SetUInt64

func (args Arguments) SetUInt64(name string, value uint64) Arguments

type CommandExecutor

type CommandExecutor func(Arguments, io.Writer) error

Execute command-line tool and write result into writer To simplify interpretation of execution result you can use ExecutionResultRecorder interface and its default implementations

func NewCommandExecutor

func NewCommandExecutor(render CommandRenderer) CommandExecutor

Creates default command executor

type CommandRenderer

type CommandRenderer func(Arguments) (*exec.Cmd, error)

Represents command template

func NewAutoNamedRenderer

func NewAutoNamedRenderer(text string) (CommandRenderer, error)

func NewDefaultRenderer

func NewDefaultRenderer(name string, text string) (CommandRenderer, error)

Creates default command renderer based on Go template language

type ExecutionError

type ExecutionError struct {
	ProcessExitCode int
	// contains filtered or unexported fields
}

Execution error code

func (*ExecutionError) Error

func (self *ExecutionError) Error() string

ExecutionError

type ExecutionErrorCode

type ExecutionErrorCode uint8

type ExecutionResultRecorder

type ExecutionResultRecorder interface {
	io.Writer
	io.WriterTo
	io.Closer
	Len() int
}

Used to record result of command execution and interpret this result

func NewTempFileRecorder

func NewTempFileRecorder(deleteOnClose bool) (ExecutionResultRecorder, error)

func NewTextRecorder

func NewTextRecorder() ExecutionResultRecorder

Creates a new recorder of command result which interprets process output as text

Jump to

Keyboard shortcuts

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