Have you ever wanted to stop and edit text in the middle of a pipeline? With
vipe you can!
Take the output of
brew search as an example.
$ brew search proxy ==> Formulae aws-es-proxy metaproxy proxytunnel dnscrypt-proxy mitmproxy sproxy haproxy oauth2_proxy tinyproxy ios-webkit-debug-proxy ocproxy twemproxy libproxy proxychains-ng ==> Casks proxyman
What we if want to call
brew info to get more details for those formulae?
Even if we pipe the output to something (e.g. cat) we still have the Formulae and Casks headers:
$ brew search proxy | cat ==> Formulae aws-es-proxy dnscrypt-proxy haproxy ios-webkit-debug-proxy libproxy metaproxy mitmproxy oauth2_proxy ocproxy proxychains-ng proxytunnel sproxy tinyproxy twemproxy ==> Casks proxyman
We could write some intermediate steps to remove the lines we don’t want. But wouldn’t it be great to have our pipeline stop, let us edit the stream, and then continue?
$ brew search proxy | magic | while read formula; do brew info $formula; done
It turns out that
vipe can be that magic! It will stop and give you a vim session with the output of the preceeding pipe. When you write/quit the vim session that output will be sent down to the subsequent commands in the pipe. Awesome!
You can get
vipe on OSX as part of the
moreutils brew formula.
$ brew install moreutils
Then drop it in wherever you want to quickly edit text in the middle of the pipeline. It’s also great as a nice way to view intermediate output of a pipeline.
$ brew search proxy | vipe | while read formula; do brew info $formula; done