Add bin/wee (weechat pipe script)

This commit is contained in:
Henrik Lissner 2016-11-07 01:50:04 +01:00
parent ef023098ac
commit 15f8287ac3

20
bin/wee Executable file
View file

@ -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_*