Documentation
¶
Index ¶
- func ExeName(path string) string
- type Bsh
- func (b *Bsh) Append(path string, contents string)
- func (b *Bsh) AppendBytes(path string, data []byte)
- func (b *Bsh) AppendBytesErr(path string, data []byte) error
- func (b *Bsh) AppendErr(path string, contents string) error
- func (b *Bsh) Appendf(path string, format string, args ...interface{})
- func (b *Bsh) Ask(msg string) string
- func (b *Bsh) Askf(format string, args ...interface{}) string
- func (b *Bsh) Chdir(dir string)
- func (b *Bsh) Cmd(command string) *Command
- func (b *Bsh) Cmdf(format string, args ...interface{}) *Command
- func (b *Bsh) Echo(str string)
- func (b *Bsh) Echof(format string, args ...interface{})
- func (b *Bsh) ExeName(path string) string
- func (b *Bsh) Exists(path string) bool
- func (b *Bsh) Getwd() string
- func (b *Bsh) IsDir(path string) bool
- func (b *Bsh) IsFile(path string) bool
- func (b *Bsh) IsVerbose() bool
- func (b *Bsh) MkdirAll(dir string)
- func (b *Bsh) Panic(err error)
- func (b *Bsh) PopEchoFilter()
- func (b *Bsh) PushEchoFilter(str string)
- func (b *Bsh) Read(path string) string
- func (b *Bsh) ReadErr(path string) (string, error)
- func (b *Bsh) ReadFile(path string) []byte
- func (b *Bsh) Remove(dir string)
- func (b *Bsh) RemoveAll(dir string)
- func (b *Bsh) ScanLine() string
- func (b *Bsh) ScanLineErr() (string, error)
- func (b *Bsh) SetErrorHandler(fnErr func(error))
- func (b *Bsh) SetVerbose(v bool)
- func (b *Bsh) SetVerboseEnvVarName(s string)
- func (b *Bsh) Stat(path string) fs.FileInfo
- func (b *Bsh) Verbose(str string)
- func (b *Bsh) Verbosef(format string, args ...interface{})
- func (b *Bsh) Warn(str string)
- func (b *Bsh) Warnf(format string, args ...interface{})
- func (b *Bsh) Write(path string, contents string)
- func (b *Bsh) WriteBytes(path string, data []byte)
- func (b *Bsh) WriteBytesErr(path string, data []byte) error
- func (b *Bsh) WriteErr(path string, contents string) error
- func (b *Bsh) Writef(path string, format string, args ...interface{})
- type Command
- func (c *Command) Bash()
- func (c *Command) BashErr() error
- func (c *Command) BashExitStatus() int
- func (c *Command) BashStr() string
- func (c *Command) Env(vars ...string) *Command
- func (c *Command) Err(out io.Writer) *Command
- func (c *Command) ExitStatus(n *int) *Command
- func (c *Command) ExpandEnv() *Command
- func (c *Command) In(in io.Reader) *Command
- func (c *Command) Out(out io.Writer) *Command
- func (c *Command) OutErr(out io.Writer) *Command
- func (c *Command) Run()
- func (c *Command) RunErr() error
- func (c *Command) RunExitStatus() int
- func (c *Command) RunStr() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bsh ¶
type Bsh struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
DisableColor bool
// contains filtered or unexported fields
}
func (*Bsh) AppendBytes ¶
func (*Bsh) Exists ¶
Exists checks if this path already exists on disc (as a file or folder or whatever)
func (*Bsh) IsDir ¶
IsDir checks if this path is a folder (returns false if path doesn't exist, or exists but is a file)
func (*Bsh) IsFile ¶
IsFile checks if this path is a file (returns false if path doesn't exist, or exists but is a folder)
func (*Bsh) Panic ¶
Panic is called internally any time there's an unhandled error. It will in turn call any error handler set by SetErrorHandler, or panic() if no error handler was set.
func (*Bsh) PopEchoFilter ¶
func (b *Bsh) PopEchoFilter()
func (*Bsh) PushEchoFilter ¶
func (*Bsh) ScanLineErr ¶
func (*Bsh) SetErrorHandler ¶
SetErrorHandler sets the behavior when an error is encountered while running most commands. The default behavior is to panic.
func (*Bsh) SetVerbose ¶
func (*Bsh) SetVerboseEnvVarName ¶
SetVerboseEnvVarName allows changing the name of the environment variable that is used to decide if we are in Verbose mode. This function creates the new env var immediately, setting its value to true or false based on the value of the old env var name.
func (*Bsh) WriteBytes ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func (*Command) BashExitStatus ¶
func (*Command) Env ¶
Env adds environment variables in the form "KEY=VALUE", to be set on exec.Cmd.Env. Note: these env vars are not seen by ExpandEnv.
func (*Command) ExitStatus ¶
func (*Command) ExpandEnv ¶
ExpandEnv calls os.ExpandEnv on the command string before it is parsed and passed to exec.Cmd.

