From 15f8287ac3550fda59d1a2ff2f0ae2824ced71a8 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 7 Nov 2016 01:50:04 +0100 Subject: [PATCH] Add bin/wee (weechat pipe script) --- bin/wee | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 bin/wee diff --git a/bin/wee b/bin/wee new file mode 100755 index 00000000..ff820088 --- /dev/null +++ b/bin/wee @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Pipes input to the weechat fifo (strips commented lines +# and prepends * to commands). + +fifos=$(echo "$HOME/.weechat/weechat_fifo_*") +if [ -z "$fifos" ] +then + >&2 echo "No FIFOs. Is weechat running?" + exit 1 +fi + +if [ -t 0 ]; then + cat $@ +else + while read -r line + do + echo $line + done +fi | sed '/^ *#.+/ d' | sed 's/^/*/g' > $HOME/.weechat/weechat_fifo_*