pipeline

package module
v0.0.0-...-32d779b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2019 License: MIT Imports: 3 Imported by: 56

README

go-pipeline

unix command pipeline on golang

Usage

out, err := Output(
	[]string{"git", "log", "--oneline"},
	[]string{"grep", "first import"},
	[]string{"wc", "-l"},
)
if err != nil {
	log.Fatal(err)
}
fmt.Println(string(out))
// Output:
// 1
out, _ = CombinedOutput(
	[]string{"rmdir", "not_exist_dir"},
)
fmt.Println(string(out))
// Output:
// rmdir: failed to remove 'not_exist_dir': No such file or directory

Installation

$ go get github.com/mattn/go-pipeline

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombinedOutput

func CombinedOutput(commands ...[]string) ([]byte, error)

CombinedOutput runs the commands and returns its combined standard output and standard error.

func Output

func Output(commands ...[]string) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL