moved weechatlinks into st build

This commit is contained in:
Alexander Bocken 2021-05-16 19:09:12 +02:00
parent eaa5964611
commit 614f381831
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8

View File

@ -1,28 +0,0 @@
#!/bin/sh
all="$(perl -pe 's/[^│]*([^│]*?)│/\1/' |
perl -pe 's/^.*?\| //' |
sed 's/ │.*//' |
head -n-3 | tr -d '\n'|
grep -aEo '(<[^]]*>|\[[^ ]*\])')"
filenames="$( echo "$all" | grep -E '^<[^>]*>' | tr -d '<>')"
links="$( echo "$all" | grep -E '^\[' | tr -d [])"
choice="$(printf 'most recent\nall\n%s' "$filenames" | dmenu -i -p 'open which file?' -l 10)"
case "$choice" in
"most recent") link="$(echo "$links" | tail -n1)";;
"all") link="$links";;
*) #TODO: implement dmenu multiline support
linenr="$(echo "$filenames" | awk "/$choice/ {print NR}")"
[ "$(echo "$linenr" | wc -l)" -gt 1 ] && notify-send "weechatdls" "multiple files with that name, not yet supported"
link="$(echo "$links" | awk "NR==$linenr")";;
esac
if [ "$(echo "$link" | wc -l)" -eq 1 ]; then
if echo "$link" | grep -qE '^emxc'; then
matrix_decrypt.py "$link"
else
curl -L "$link" -o "/tmp/$choice"
rifle "/tmp/$choice"
fi
else
notify-send "weechatdls" "multi-link downloads not yet supported"
fi