Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Args = script.Args
Args creates a pipe containing the program's command-line arguments, one per line.
var Echo = script.Echo
Echo returns a pipe containing the supplied string.
var File = script.File
File returns a *Pipe associated with the specified file. This is useful for starting pipelines. If there is an error opening the file, the pipe's error status will be set.
var FindFiles = script.FindFiles
FindFiles takes a directory path and returns a pipe listing all the files in the directory and its subdirectories recursively, one per line, like Unix `find -type f`. If the path doesn't exist or can't be read, the pipe's error status will be set.
var IfExists = script.IfExists
IfExists tests whether the specified file exists, and creates a pipe whose error status reflects the result. If the file doesn't exist, the pipe's error status will be set, and if the file does exist, the pipe will have no error status. This can be used to do some operation only if a given file exists:
IfExists("/foo/bar").Exec("/usr/bin/something")
var ListFiles = script.ListFiles
ListFiles creates a pipe containing the files and directories matching the supplied path, one per line. The path may be a glob, conforming to filepath.Match syntax.
var Slice = script.Slice
Slice creates a pipe containing each element of the supplied slice of strings, one per line.
Functions ¶
func ExecStdout ¶
ExecStdout runs an external command and writes the contents of the pipe to the program's standard output.
Types ¶
type Pipe ¶
Pipe represents a pipe object with an associated ReadAutoCloser. https://pkg.go.dev/github.com/bitfield/script#readme-quick-start-unix-equivalents
func Buffer ¶ added in v0.1.1
Buffer returns a *Pipe associated with the reader buffers. This is useful for starting pipelines. If there is an error opening the file, the pipe's error status will be set.