command

package
v0.0.0-...-fd74006 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AppName is shown on notifications as application name
	AppName = "Start up"

	// TitleError is shown on notification as error title
	TitleError = "Error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Cmd *exec.Cmd
}

Command wraps exec.Cmd and has some command execution method with notification

func New

func New(cmd string, cmdOption []string, execOption ...Option) *Command

NewCommand creates Command with given options

func (*Command) Run

func (c *Command) Run()

Run executes command contained in Command and notify when it fails

type Env

type Env map[string]string

Env is alias to map[string]string to express key-value structure of environment variables

type Option

type Option func(*Command)

Option is functional option for Command

func OptionEnv

func OptionEnv(env Env) Option

OptionEnv returns functional option with given Env to replace Cmd.Env

func OptionStdout

func OptionStdout(stdout io.Writer) Option

OptionStdout returns functional option with given io.Writer to replace Cmd.Stdout

func OptionWorkingDir

func OptionWorkingDir(dir string) Option

OptionWorkingDir returns functional option with given string describes woking directory to replace Cmd.Dir

Jump to

Keyboard shortcuts

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