Documentation
¶
Index ¶
- func CreateRandomLenFile(maxLen int, filesDir string, prefix string) string
- func RunCmd(config CmdConfig) error
- func RunCmdOutput(config CmdConfig) (string, error)
- func RunCmdWithOutputParser(config CmdConfig, prompt bool, regExpStruct ...*CmdOutputPattern) (out string, exitOk bool, err error)
- type CmdConfig
- type CmdOutputPattern
- type RandFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateRandomLenFile ¶
func RunCmdOutput ¶ added in v1.0.3
Executes an external process and returns its output. If the returned output is not needed, use the RunCmd function instead , for better performance.
func RunCmdWithOutputParser ¶ added in v1.0.3
func RunCmdWithOutputParser(config CmdConfig, prompt bool, regExpStruct ...*CmdOutputPattern) (out string, exitOk bool, err error)
Executes the command and captures the output. Analyze each line to match the provided regex. Returns the complete stdout output of the command.
Types ¶
type CmdConfig ¶ added in v1.0.3
type CmdConfig interface { GetCmd() *exec.Cmd GetEnv() map[string]string GetStdWriter() io.WriteCloser GetErrWriter() io.WriteCloser }
type CmdOutputPattern ¶ added in v1.0.3
type CmdOutputPattern struct { RegExp *regexp.Regexp MatchedResults []string Line string ExecFunc func(pattern *CmdOutputPattern) (string, error) }
RegExp - The regexp that the line will be searched upon. MatchedResults - The slice result that was found by the regex Line - The output line from the external process ExecFunc - The function to execute
Click to show internal directories.
Click to hide internal directories.