Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

babarot/go-pipe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

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:

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)
	}
}

Installation

$ go get github.com/b4b4r07/go-pipe

License

MIT

thanks

How to pipe several commands? - Stack Overflow

Author

BABAROT a.k.a. b4b4r07

About

Unix-like pipelines for Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages