Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/babarot/go-pipe
Unix-like pipelines for Go
https://github.com/babarot/go-pipe
Last synced: 4 days ago
JSON representation
Unix-like pipelines for Go
- Host: GitHub
- URL: https://github.com/babarot/go-pipe
- Owner: babarot
- Created: 2015-05-28T08:39:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-08T09:33:49.000Z (about 4 years ago)
- Last Synced: 2024-11-02T13:21:50.963Z (11 days ago)
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 16
- Watchers: 3
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-pipe
Unix-like pipelines for Go
## Description
How to pipe several commands? ...such as `ls ~/Download | grep Vim`. Use this package `go-pipe`!!
## Requirements
- Go
## Usage
1. Run `go get github.com/b4b4r07/go-pipe`
2. Put something like this in your `~/.bashrc` or `~/.zshrc`:
```go
import "github.com/b4b4r07/go-pipe"
```### example
```go
package mainimport (
"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)
}
}
```## Installation
$ go get github.com/b4b4r07/go-pipe
## License
[MIT](https://raw.githubusercontent.com/b4b4r07/dotfiles/master/doc/LICENSE-MIT.txt)
### thanks
[How to pipe several commands? - Stack Overflow](http://stackoverflow.com/questions/10781516/how-to-pipe-several-commands)
## Author
[BABAROT](http://tellme.tokyo) a.k.a. b4b4r07