Documentation ¶
Index ¶
- Variables
- func AddExecPath(execPath string)
- func Commands(cmdStrs ...string) *exec.CommandBuilder
- func Eval(str string) string
- func FileRead(path string) *fs.FileReader
- func FileWrite(path string) *fs.FileWriter
- func GetUrl(url string) *http.ResourceReader
- func MkDir(path string) *fs.FSInfo
- func MkDirs(path string, mode os.FileMode) *fs.FSInfo
- func NewProc(cmdStr string) *exec.Proc
- func PathExists(path string) bool
- func PathInfo(path string) *fs.FSInfo
- func Pipe(cmdStrs ...string) *exec.PipedCommandResult
- func PostUrl(url string) *http.ResourceWriter
- func Prog() *prog.Info
- func ProgAvail(program string) string
- func RmPath(path string) *fs.FSInfo
- func Run(cmdStr string) string
- func RunAll(cmdStrs ...string) *exec.CommandResult
- func RunConcur(cmdStrs ...string) *exec.CommandResult
- func RunProc(cmdStr string) *exec.Proc
- func Runout(cmdStr string)
- func StartAll(cmdStrs ...string) *exec.CommandResult
- func StartConcur(cmdStrs ...string) *exec.CommandResult
- func StartProc(cmdStr string) *exec.Proc
- func String(s string) *str.Str
- func Val(name string) string
- func Variables() *vars.Variables
- func Workdir() string
- type Echo
- func (e *Echo) AddExecPath(execPath string)
- func (e *Echo) AddressUsable(addr string) error
- func (e *Echo) Commands(cmdStrs ...string) *exec.CommandBuilder
- func (e *Echo) Envs(val string) *Echo
- func (e *Echo) Eval(str string) string
- func (e *Echo) FileAppend(path string) *fs.FileWriter
- func (e *Echo) FileRead(path string) *fs.FileReader
- func (e *Echo) FileWrite(path string) *fs.FileWriter
- func (e *Echo) Get(url string, paths ...string) *http.ResourceReader
- func (e *Echo) MkDir(path string, mode os.FileMode) *fs.FSInfo
- func (e *Echo) NewProc(cmdStr string) *exec.Proc
- func (e *Echo) ParseCommand(cmdStr string) (cmdName string, args []string)
- func (e *Echo) PathExists(path string) bool
- func (e *Echo) PathInfo(path string) *fs.FSInfo
- func (e *Echo) Pipe(cmdStrs ...string) *exec.PipedCommandResult
- func (e *Echo) Post(url string, paths ...string) *http.ResourceWriter
- func (e *Echo) Prog() *prog.Info
- func (e *Echo) ProgAvail(progName string) string
- func (e *Echo) RmPath(path string) *fs.FSInfo
- func (e *Echo) Run(cmdStr string) string
- func (e *Echo) RunAll(cmdStrs ...string) *exec.CommandResult
- func (e *Echo) RunConcur(cmdStrs ...string) *exec.CommandResult
- 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) StartAll(cmdStrs ...string) *exec.CommandResult
- func (e *Echo) StartConcur(cmdStrs ...string) *exec.CommandResult
- func (e *Echo) StartProc(cmdStr string) *exec.Proc
- func (e *Echo) String(s string) *str.Str
- func (e *Echo) UnsetVar(name string) *Echo
- func (e *Echo) Val(name string) string
- func (e *Echo) Variables() *vars.Variables
- func (e *Echo) Vars(val string) *Echo
- func (e *Echo) Workdir() string
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultEcho surfaces an Echo session used for all package functions DefaultEcho = New() )
Functions ¶
func AddExecPath ¶ added in v0.3.0
func AddExecPath(execPath string)
AddExecPath adds an executable path to PATH
func Commands ¶ added in v0.2.0
func Commands(cmdStrs ...string) *exec.CommandBuilder
Commands returns a *exe.CommandBuilder to build a multi-command execution flow.
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 FileRead ¶ added in v0.3.0
func FileRead(path string) *fs.FileReader
FileRead provides methods to read file content from path
func FileWrite ¶ added in v0.3.0
func FileWrite(path string) *fs.FileWriter
FileWrite provides methods to write file content to path
func GetUrl ¶ added in v0.2.0
func GetUrl(url string) *http.ResourceReader
GetUrl creates a *http.ResourceReader to retrieve HTTP content
func NewProc ¶ added in v0.2.0
NewProc setups a new process with specified command cmdStr and returns immediately without starting. Information about the running process is stored in *exec.Proc.
func PathExists ¶ added in v0.3.0
PathExists returns true if specified path exists. Any error will cause it to return false.
func Pipe ¶ added in v0.2.0
func Pipe(cmdStrs ...string) *exec.PipedCommandResult
Pipe executes each command, in cmdStrs, by piping the result of the previous command as input to the next command until done.
func PostUrl ¶ added in v0.2.0
func PostUrl(url string) *http.ResourceWriter
PostUrl creates a *http.ResourceWriter to write content to an HTTP server
func RunAll ¶ added in v0.2.0
func RunAll(cmdStrs ...string) *exec.CommandResult
RunAll executes each command, in cmdStrs, successively and wait for their completion.
func RunConcur ¶ added in v0.2.0
func RunConcur(cmdStrs ...string) *exec.CommandResult
RunConcur executes each command, in cmdStrs, concurrently and waits their completion.
func RunProc ¶
RunProc executes command in cmdStr and waits for the result. It returns a *Proc with information about the executed process.
func StartAll ¶ added in v0.2.0
func StartAll(cmdStrs ...string) *exec.CommandResult
StartAll starts the exection of each command sequentially and does not wait for their completion.
func StartConcur ¶ added in v0.2.0
func StartConcur(cmdStrs ...string) *exec.CommandResult
StartConcur starts the exection of each command concurrently and does not wait for their completion.
func StartProc ¶
StartProc executes the command in cmdStr and returns immediately without waiting. Information about the running process is stored in *exec.Proc.
Types ¶
type Echo ¶
type Echo struct {
// 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) AddExecPath ¶ added in v0.3.0
AddExecPath adds an executable path to PATH
func (*Echo) AddressUsable ¶ added in v0.3.0
func (*Echo) Commands ¶ added in v0.2.0
func (e *Echo) Commands(cmdStrs ...string) *exec.CommandBuilder
Commands returns a *exe.CommandBuilder to build a multi-command execution flow.
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) FileAppend ¶ added in v0.3.0
func (e *Echo) FileAppend(path string) *fs.FileWriter
FileAppend provides methods to append content to provided path
FileAppend(path).String("hello world")
func (*Echo) FileRead ¶ added in v0.3.0
func (e *Echo) FileRead(path string) *fs.FileReader
FileRead provides methods to read file content
FileRead(path).Lines()
func (*Echo) FileWrite ¶ added in v0.3.0
func (e *Echo) FileWrite(path string) *fs.FileWriter
FileWrite provides methods to write content to provided path
FileWrite(path).String("hello world")
func (*Echo) Get ¶ added in v0.2.0
func (e *Echo) Get(url string, paths ...string) *http.ResourceReader
Get creates a *http.ResourceReader to read resource content from HTTP server
func (*Echo) MkDir ¶ added in v0.3.0
MkDir creates a directory at specified path with mode value. FSInfo contains information about the path or error if occured
func (*Echo) NewProc ¶ added in v0.2.0
NewProc setups a new process with specified command cmdStr and returns immediately without starting. Use Proc.Wait to wait for exection and then retrieve process result. Information about the running process is stored in *exec.Proc.
func (*Echo) ParseCommand ¶ added in v0.3.0
ParseCommand parses the string into individual command tokens
func (*Echo) PathExists ¶ added in v0.3.0
PathExists returns true if path exists. All errors causes to return false.
func (*Echo) Pipe ¶ added in v0.2.0
func (e *Echo) Pipe(cmdStrs ...string) *exec.PipedCommandResult
Pipe executes each command, in cmdStrs, by piping the result of the previous command as input to the next command until done.
func (*Echo) Post ¶ added in v0.2.0
func (e *Echo) Post(url string, paths ...string) *http.ResourceWriter
Post creates a *http.ResourceWriter to write content to an HTTP server
func (*Echo) ProgAvail ¶ added in v0.3.0
ProgAvail returns the full path of the program if found on exec PATH
func (*Echo) RmPath ¶ added in v0.3.0
RmPath removes specified path (dir or file). Error is returned FSInfo.Err()
func (*Echo) RunAll ¶ added in v0.2.0
func (e *Echo) RunAll(cmdStrs ...string) *exec.CommandResult
RunAll executes each command sequentially, in cmdStrs, and wait for their completion.
func (*Echo) RunConcur ¶ added in v0.2.0
func (e *Echo) RunConcur(cmdStrs ...string) *exec.CommandResult
RunConcur executes each command concurrently, in cmdStrs, and waits their completion.
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) StartAll ¶ added in v0.2.0
func (e *Echo) StartAll(cmdStrs ...string) *exec.CommandResult
StartAll starts the sequential execution of each command, in cmdStrs, and does not wait for their completion.
func (*Echo) StartConcur ¶ added in v0.2.0
func (e *Echo) StartConcur(cmdStrs ...string) *exec.CommandResult
StartConcur starts the concurrent execution of each command, in cmdStrs, and does not wait for their completion.
func (*Echo) StartProc ¶
StartProc executes the command in cmdStr and returns immediately without waiting. Use Proc.Wait to wait for exection and then retrieve process result. Information about the running process is stored in *Proc.
func (*Echo) String ¶ added in v0.3.0
String creates a new str.Str value with string manipulation methods