Unix-like pipelines for Go
How to pipe several commands? ...such as ls ~/Download | grep Vim
. Use this package go-pipe
!!
- Go
-
Run
go get github.com/b4b4r07/go-pipe
-
Put something like this in your
~/.bashrc
or~/.zshrc
:
import "github.com/b4b4r07/go-pipe"
### example
```go
package main
import (
"bytes"
"io"
"log"
"os"
"os/exec"
pipe "github.com/b4b4r07/go-pipe"
)
func main() {
var b bytes.Buffer
if err := pipe.Command(&b,
exec.Command("ls", "/Users/b4b4r07/Downloads"),
exec.Command("grep", "Vim"),
); err != nil {
log.Fatal(err)
}
if _, err := io.Copy(os.Stdout, &b); err != nil {
log.Fatal(err)
}
}
$ go get github.com/b4b4r07/go-pipe
How to pipe several commands? - Stack Overflow
BABAROT a.k.a. b4b4r07