From 02d65afdcbdbfd2a8cdfedec353e992ad0d0bfe0 Mon Sep 17 00:00:00 2001 From: Florian Baumann Date: Wed, 10 Nov 2010 20:25:40 +0100 Subject: [PATCH] added pipe-able browser hack from defunkt --- plugins/browser.plugin.bash | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 plugins/browser.plugin.bash diff --git a/plugins/browser.plugin.bash b/plugins/browser.plugin.bash new file mode 100644 index 0000000..6de184c --- /dev/null +++ b/plugins/browser.plugin.bash @@ -0,0 +1,29 @@ +# based on https://gist.github.com/318247 + +# Usage: browser +# pipe html to a browser +# e.g. +# $ echo "

hi mom!

" | browser +# $ ron -5 man/rip.5.ron | browser + +function browser() { + if [ -t 0 ]; then + if [ -n "$1" ]; then + open $1 + else + cat <hi mom!' | browser +$ ron -5 man/rip.5.ron | browser +usage + + fi + + else + f="/tmp/browser.$RANDOM.html" + cat /dev/stdin > $f + open $f + fi +} -- 2.17.1