commander

package module
v0.0.0-...-affed6f Latest Latest
Warning

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

Go to latest
Published: May 7, 2017 License: GPL-3.0 Imports: 9 Imported by: 2

README

commander

An extensible application-subcommands framework à la git-* subcommands

reportcard build godoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(binary string, args []string, env []string) error

func Launch

func Launch(args []string, env []string, exe func(string, []string, []string) error) error

func Spawn

func Spawn(binary string, args []string, env []string) error

Types

type Commanding

type Commanding struct {
	Cmd    *exec.Cmd
	Prefix string
	Binary string
	// contains filtered or unexported fields
}

func New

func New(prefix string) *Commanding

func (*Commanding) Args

func (c *Commanding) Args(args ...string) *Commanding

Append args to the command arguments.

func (*Commanding) Env

func (c *Commanding) Env(env ...string) *Commanding

Append env to the command environment.

func (*Commanding) EnvMap

func (c *Commanding) EnvMap(env map[string]interface{}) *Commanding

Append the map to the command environment as key=value for each key/value pair, quoting value.

func (Commanding) Execute

func (c Commanding) Execute() error

Exec the command. To execute a specific binary without first calling c.LookPath, just set c.Binary

func (*Commanding) Inherit

func (c *Commanding) Inherit(from int) *Commanding

Append os.Args[from:] to the command arguments.

func (*Commanding) LookPath

func (c *Commanding) LookPath(name string) (*Commanding, error)

Looks up the prefix+name in the PATH. If found, assigns c.Binary. To execute a specific binary without first calling c.LookPath, just set c.Binary

func (*Commanding) String

func (c *Commanding) String() string

Reproduce a command line string that reflects a usable command line.

type Executor

type Executor func(string, []string, []string) error

Jump to

Keyboard shortcuts

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