shell

package
v2.0.0-...-21d7e90 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandExists

func CommandExists(name string) bool

CommandExists returns true if the given command can be found on the shell

func CreateCommand

func CreateCommand(directory string, command string, args ...string) *exec.Cmd

CreateCommand returns a *Cmd struct that when run, will run the given command + args in the given directory

func RunCommand

func RunCommand(directory string, command string, args ...string) (string, string, error)

RunCommand will run the given command + args in the given directory Will return stdout, stderr and error

func RunCommandVerbose

func RunCommandVerbose(directory string, command string, args ...string) error

RunCommandVerbose will run the given command + args in the given directory Will return an error if one occurs

Types

type Command

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

func NewCommand

func NewCommand(command string) *Command

func (*Command) AddArgs

func (c *Command) AddArgs(args []string)

func (*Command) Dir

func (c *Command) Dir(dir string)

func (*Command) Env

func (c *Command) Env(name string, value string)

func (*Command) Run

func (c *Command) Run() error

func (*Command) Stderr

func (c *Command) Stderr() string

func (*Command) Stdout

func (c *Command) Stdout() string

Jump to

Keyboard shortcuts

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