command

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: GPL-3.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PathChecker = PathChecked{}

Functions

This section is empty.

Types

type AddEnvironment

type AddEnvironment struct {
	// contains filtered or unexported fields
}

func AddEnv

func AddEnv(e environment.Env) (a AddEnvironment)

func (AddEnvironment) ConfigureCommand

func (a AddEnvironment) ConfigureCommand(cmd *exec.Cmd)

type Caller

type Caller interface {
	Call(args []string) (b []byte, err error)
}

type Command

type Command struct {
	Caller
}

func New

func New(caller Caller) (c Command)

func (Command) Call

func (c Command) Call(args ...interface{}) (b []byte, err error)

type Configure

type Configure interface {
	ConfigureCommand(*exec.Cmd)
}

type Configures

type Configures struct {
	// contains filtered or unexported fields
}

func (Configures) ConfigureCommand

func (c Configures) ConfigureCommand(cmd *exec.Cmd)

type CreateWithContext

type CreateWithContext struct {
	// contains filtered or unexported fields
}

func WithContext

func WithContext(ctx context.Context) (c CreateWithContext)

func (CreateWithContext) NewCmd

func (cw CreateWithContext) NewCmd(name string, args ...string) (c *exec.Cmd, err error)

type Creator

type Creator interface {
	Create(name string, args ...string) (*exec.Cmd, error)
}

type Debug

type Debug struct {
	// contains filtered or unexported fields
}

func NewDebug

func NewDebug(w io.Writer, execPath string) (d Debug)

func (Debug) Call

func (d Debug) Call(args []string) (_ []byte, err error)

type DebugBuilder

type DebugBuilder struct {
	// contains filtered or unexported fields
}

func NewDebugBuilder

func NewDebugBuilder(w io.Writer) (d DebugBuilder)

func (DebugBuilder) NewCommand

func (d DebugBuilder) NewCommand(execPath string) (c Command, err error)

type DefaultCreator

type DefaultCreator struct{}

func (DefaultCreator) NewCmd

func (_ DefaultCreator) NewCmd(name string, args ...string) (c *exec.Cmd, err error)

type Error

type Error struct {
	// The string describing the executable.
	Exec string
	// Message written to stderr from the executable.
	Message []byte
	// contains filtered or unexported fields
}

An error describing the context of a failed communication with a process.

func (Error) Error

func (e Error) Error() (s string)

Implements the error interface.

func (Error) Unwrap

func (e Error) Unwrap() (err error)

Can be unwrapped.

type Executable

type Executable struct {
	// contains filtered or unexported fields
}

func NewExecutable

func NewExecutable(cmd string) (e Executable)

func (Executable) Call

func (e Executable) Call(args []string) (b []byte, err error)

type Fail

type Fail struct {
	// contains filtered or unexported fields
}

func (Fail) Error

func (f Fail) Error() string

func (Fail) Unwrap

func (f Fail) Unwrap() error

func (*Fail) Wrap

func (f *Fail) Wrap(err error) error

type FrozenArguments

type FrozenArguments struct {
	// contains filtered or unexported fields
}

type Git

type Git struct {
	// contains filtered or unexported fields
}

A wrapper around the git command line application. Implements the VCS interface.

func DefaultGit

func DefaultGit() (g Git)

func NewGit

func NewGit(command Caller) (g Git)

func (Git) Status

func (g Git) Status() (b []byte, err error)

type PathChecked

type PathChecked struct{}

func (PathChecked) CreateCmd

func (_ PathChecked) CreateCmd(name string, args ...string) (c *exec.Cmd, err error)

type Process

type Process struct {
	Stderr io.ReadCloser
	Stdout io.ReadCloser
	Stdin  io.WriteCloser
	// contains filtered or unexported fields
}

A wrapper around a process that pipes input to the started process, handles output and errors returned by the process.

func (Process) Wait

func (p Process) Wait() (err error)

Waits for the process to close.

func (*Process) Write

func (p *Process) Write(b []byte) (n int, err error)

Send data to the started process. After writing to the stdin pipe, the function reads from the stderr and reports any errors.

type ProcessCommand

type ProcessCommand struct {
	// contains filtered or unexported fields
}

ProcessCommand is a wrapper around a path to a valid executable file. It can be used to start up a process with a set of arguments.

func (ProcessCommand) Start

func (pc ProcessCommand) Start(args ...string) (p Process, err error)

Start a process and setup it's pipes.

type SetEnvironment

type SetEnvironment struct {
	// contains filtered or unexported fields
}

func SetEnv

func SetEnv(e environment.Env) (s SetEnvironment)

func (SetEnvironment) ConfigureCommand

func (s SetEnvironment) ConfigureCommand(cmd *exec.Cmd)

type VCS

type VCS interface {
	Status() (b []byte, err error)
}

Represents a common set of functions implemented by most version control systems.

TODO(bozso): Set up functions for other functionalities.

Jump to

Keyboard shortcuts

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