Documentation
¶
Index ¶
- Variables
- func Eval(str string) string
- func Prog() *prog.Info
- func Read(path string) fs.FileReader
- func Run(cmdStr string) string
- func RunProc(cmdStr string) *exec.Proc
- func Runout(cmdStr string)
- func StartProc(cmdStr string) *exec.Proc
- func Val(name string) string
- func Variables() *vars.Variables
- func Write(path string) fs.FileWriter
- type Config
- type Echo
- func (e *Echo) Envs(val string) *Echo
- func (e *Echo) Eval(str string) string
- func (e *Echo) Prog() *prog.Info
- func (e *Echo) Read(path string) fs.FileReader
- func (e *Echo) Run(cmdStr string) string
- func (e *Echo) RunProc(cmdStr string) *exec.Proc
- func (e *Echo) Runout(cmdStr string)
- func (e *Echo) SetEnv(name, value string) *Echo
- func (e *Echo) SetVar(name, value string) *Echo
- func (e *Echo) StartProc(cmdStr string) *exec.Proc
- func (e *Echo) Val(name string) string
- func (e *Echo) Variables() *vars.Variables
- func (e *Echo) Vars(val string) *Echo
- func (e *Echo) Write(path string) fs.FileWriter
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultEcho surfaces an Echo session used for all package functions DefaultEcho = New() )
Functions ¶
func Eval ¶
Eval returns the string str with its content expanded with variable values i.e. Eval("I am $HOME") returns "I am </user/home/path>"
func Read ¶
func Read(path string) fs.FileReader
Read creates an fs.FileReader that can be used to read content from files.
func RunProc ¶
RunProc executes command in cmdStr and waits for the result. It returns a *Proc with information about the executed process.
func StartProc ¶
StartProc executes the command in cmdStr and returns immediately without waiting. Information about the running process is stored in *exec.Proc.
func Write ¶
func Write(path string) fs.FileWriter
Write creates an fs.FileWriter that can be used to write content to files
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config stores configuration
func (*Config) GetEscapeChar ¶
GetEscapeChar returns the escape char set for command-line parsing
func (*Config) IsPanicOnErr ¶
IsPanicOnErr returns panic-on-error flag
func (*Config) SetEscapeChar ¶
SetEscapeChar sets the escape char for command-line parsing
func (*Config) SetPanicOnErr ¶
SetPanicOnErr panics program on any error
type Echo ¶
type Echo struct {
Conf *Config // session config
// contains filtered or unexported fields
}
Echo represents a new Echo session used for accessing Gexe types and methods.
func Envs ¶
Envs declares environment variables using a multi-line space-separated list:
Envs("GOOS=linux GOARCH=amd64")
Environment vars can be used in string values using Eval("building for os=$GOOS")
func Vars ¶
Vars declares session-scope variables using a multi-line space-separated list:
Envs("foo=bar platform=amd64")
Session vars can be used in string values using Eval("My foo=$foo").
Note that session vars are only available for the running process.
func (*Echo) Envs ¶
Envs declares environment variables using a multi-line space-separated list:
Envs("GOOS=linux GOARCH=amd64")
Environment vars can be used in string values using Eval("building for os=$GOOS")
func (*Echo) Eval ¶
Eval returns the string str with its content expanded with variable values i.e. Eval("I am $HOME") returns "I am </user/home/path>"
func (*Echo) Read ¶
func (e *Echo) Read(path string) fs.FileReader
Read creates an fs.FileReader using the provided path
func (*Echo) RunProc ¶
RunProc executes command in cmdStr and waits for the result. It returns a *Proc with information about the executed process.
func (*Echo) StartProc ¶
StartProc executes the command in cmdStr and returns immediately without waiting. Information about the running process is stored in *Proc.