Documentation ¶
Index ¶
- func FileGlob(path string) ([]string, error)
- func FileLines(path string) []string
- func FileRead(path string) string
- func InsertStr(a []string, b string, i int) []string
- func IsDir(p string) bool
- func IsFile(p string) bool
- func PathWalker(sh *strings.Builder) func(string, fs.DirEntry, error) error
- func PipeStr(prefix string, str string) string
- func StringToFile(path string, s string) error
- type RunArg
- type RunOut
- type RunPrinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileRead ¶
Reads a file `path` then returns the contents as a string. Always returns a string value. An empty string "" is returned for errors or nonexistent/unreadable files.
func PathWalker ¶
Returns a function for walking a path for files. Files are read and then contents are written to a strings.Builder pointer.
func PipeStr ¶
Prefix string `s` with pipes "│". Used to "prettify" command line output. Returns new string.
func StringToFile ¶
Writes the string `s` to the file `path`. It returns any error encountered, nil otherwise.
Types ¶
type RunArg ¶
type RunArg struct { Exe string Args []string Dir string Env []string Stdin []byte Timeout int Stdout RunPrinter Stderr RunPrinter }
func (RunArg) Run ¶
Interface to execute the given `RunArg` through `exec.Command`. The first return value is a boolean, true indicates success, false otherwise. Second value is the standard output of the command. Third value is the standard error of the command. Fourth value is error string from Run.
type RunPrinter ¶
type RunPrinter func(string)