shell

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Stdout writer
	Stdout io.Writer = os.Stdout
	// Stderr writer
	Stderr io.Writer = os.Stderr
	// Stdin reader
	Stdin io.Reader = os.Stdin
)
View Source
var (

	// HomeDir of the current user.
	HomeDir = GetHomeDir()
)

Functions

func AskConfirmation

func AskConfirmation(s string) (ret bool)

AskConfirmation ...

func CombinedOutput

func CombinedOutput(cmd string, args ...string) (string, error)

CombinedOutput runs the command and returns the text from stdout and stderr.

func CombinedOutputCmd

func CombinedOutputCmd(cmd string, args ...string) func(args ...string) (string, error)

CombinedOutputCmd uses CombinedOutput and Exec underneath.

func CombinedOutputWith

func CombinedOutputWith(env map[string]string, cmd string, args ...string) (string, error)

CombinedOutputWith is like RunWith, ubt returns what is written to stdout. and stderr

func Exec

func Exec(env map[string]string, stdout, stderr io.Writer, cmd string, args ...string) (ran bool, err error)

Exec executes the command.

func ExitStatus

func ExitStatus(err error) int

ExitStatus returns the exit status of the error if it is an exec.ExitError or if it implements ExitStatus() int. 0 if it is nil or 1 if it is a different error.

func FormatArgs

func FormatArgs(args []string) string

FormatArgs formats command line aruments to a single string.

func Get

func Get() string

Get returns the shell to use.

func GetHomeDir

func GetHomeDir() string

GetHomeDir returns the current user home directory. docker/pkg/homedir.Get()

func GetHomeShortcutString

func GetHomeShortcutString() string

GetHomeShortcutString for the home directory. docker/pkg/homedir.GetShortcutString()

func GetShortcutString

func GetShortcutString() string

GetShortcutString returns the variable to use in the native shell.

func HomeDirKey

func HomeDirKey() string

HomeDirKey returns the env var name for the user's home directory. docker/pkg/homedir.Key()

func Key

func Key() string

Key returns the env var name for the user's shell.

func Output

func Output(cmd string, args ...string) (string, error)

Output runs the command and returns the text from stdout.

func OutputCmd

func OutputCmd(cmd string, args ...string) func(args ...string) (string, error)

OutputCmd uses Ouput and Exec underneath.

func OutputWith

func OutputWith(env map[string]string, cmd string, args ...string) (string, error)

OutputWith is like RunWith, ubt returns what is written to stdout.

func Run

func Run(cmd string, args ...string) error

Run command without specifying any environment variables.

func RunCmd

func RunCmd(cmd string, args ...string) func(args ...string) error

RunCmd uses Run and Exec underneath.

func RunWith

func RunWith(env map[string]string, cmd string, args ...string) error

RunWith executes a command within the given environment.

Types

This section is empty.

Jump to

Keyboard shortcuts

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