excmd

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string
	Args        []string
	Dir         string
	Env         []string
	IOConnected bool
}

Command contains parameters for executing external commands.

func BuildCommand

func BuildCommand(name string, opts []Option) *Command

BuildCommand create a new Command object from given options.

type Executor

type Executor interface {
	Exec(ctx context.Context, name string, opts ...Option) ([]byte, error)
}

Executor is an interface for executing external commands.

func NewExecutor

func NewExecutor(io *clib.IO) Executor

NewExecutor creates a new Executor instance.

type Option

type Option func(*Command)

Option specifies external command execution configurations.

func WithArgs

func WithArgs(args ...string) Option

WithArgs sets arguments for a command.

func WithDir

func WithDir(dir string) Option

WithDir sets a working directory for a command.

func WithEnv

func WithEnv(key, value string) Option

WithEnv append a environment variable for a command.

func WithIOConnected

func WithIOConnected() Option

WithIOConnected connects i/o with a command.

func WithPATH

func WithPATH(value string) Option

WithPATH sets a PATH for a command.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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