Skip to content

Instantly share code, notes, and snippets.

@dakotahp
Created July 3, 2019 04:14
Show Gist options
  • Save dakotahp/ac02ed303ab49a038dbea8ddecece211 to your computer and use it in GitHub Desktop.
Save dakotahp/ac02ed303ab49a038dbea8ddecece211 to your computer and use it in GitHub Desktop.
Filter out useless bundler output from std-in
package main
import (
"os"
"bufio"
"fmt"
"regexp"
)
func main() {
input := bufio.NewScanner(os.Stdin)
for input.Scan() {
usingMatch, _ := regexp.MatchString("^Using", input.Text())
fetchingSourceMatch, _ := regexp.MatchString("^Fetching source index", input.Text())
fetchingGemMatch, _ := regexp.MatchString("^Fetching gem metadata", input.Text())
finalLineMatch, _ := regexp.MatchString("to see where a bundled gem is installed\.$", input.Text())
if !usingMatch && !fetchingSourceMatch && !fetchingGemMatch && !finalLineMatch {
fmt.Println(input.Text())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment