util

package
v0.0.0-...-1dd5a45 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 9 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(log *log.Logger, cmdName string, arguments ...string) (string, error)

Execute a given command. Return stderr on error, stdout on no error

func ExecDetached

func ExecDetached(log *log.Logger, cmdName string, arguments ...string) error

Execute a given command without waiting for its result.

func ExecPrintError

func ExecPrintError(log *log.Logger, cmdName string, arguments ...string) error

Execute a given command, printing stderr in case of an error

func ExecSilent

func ExecSilent(log *log.Logger, cmdName string, arguments ...string) (string, error)

Execute a given command without announcing the command. Return stderr on error, stdout on no error

func ExecuteInDir

func ExecuteInDir(folder string, action func() error) error

ExecuteInDir changes the current directory to the given folder, executes the given action and then changes the current directory back to the original.

func IsExit

func IsExit(err error) bool

func ParseVCSURL

func ParseVCSURL(url string) (*vcsurl.RepoInfo, error)

Types

type Command

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

func PrepareCommand

func PrepareCommand(log *log.Logger, cmdName string, arguments ...string) *Command

func (*Command) Announce

func (c *Command) Announce()

func (*Command) Run

func (c *Command) Run() (string, error)

Execute a given command. Return stderr on error, stdout on no error

func (*Command) RunPrintError

func (c *Command) RunPrintError() error

Execute a given command, printing stderr in case of an error

func (*Command) SetDir

func (c *Command) SetDir(dir string)

Sets the directory in which to execute the commands

func (*Command) SetStderr

func (c *Command) SetStderr(w io.Writer)

Connect stderr to the given writer

func (*Command) SetStdin

func (c *Command) SetStdin(r io.Reader)

Connect stdin to the given reader

func (*Command) SetStdout

func (c *Command) SetStdout(w io.Writer)

Connect stdout to the given writer

Jump to

Keyboard shortcuts

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