tRewrite with better branching. - plumber - simple plumber tool
HTML git clone https://git.parazyd.org/plumber
DIR Log
DIR Files
DIR Refs
---
DIR commit 03fd3e22dcda4a95c45b39371578a85d71f0fdb7
DIR parent 4d2bba59cbc1fd1a916f4e9b4195a4895c0f9e80
HTML Author: parazyd <parazyd@dyne.org>
Date: Tue, 12 May 2020 17:03:48 +0200
Rewrite with better branching.
Diffstat:
M p | 67 +++++++++++++++++++------------
1 file changed, 41 insertions(+), 26 deletions(-)
---
DIR diff --git a/p b/p
t@@ -16,39 +16,54 @@ fi
exit 1
}
-termcmd="st -e"
+TERMCMD="st -e"
case "$clip" in
-*.mp4|*.webm|*.mkv)
- mpv "$clip"
- ;;
-gopher://*/I/*)
- curl "$clip" | feh -
- ;;
gopher://*)
- $termcmd sacc "$clip"
- ;;
-ssh://*)
- $termcmd ssh "$clip"
- ;;
-telnet://*)
- $termcmd telnet "$clip"
- ;;
-https://www.youtube.com/*|ytdl://)
- mpv "$clip"
- ;;
-*.jpg|*.jpeg|*.png|*.JPG|*.JPEG|*.PNG)
- feh "$clip"
+ case "$clip" in
+ *.jpg|*.jpeg|*.JPG|*.JPEG|*.png|*.PNG)
+ curl -s "$clip" | feh - &
+ ;;
+ *.mp4|*.MP4|*.webm|*.WEBM|*.mkv|*.MKV)
+ mpv "$clip" &
+ ;;
+ *.txt|*.TXT|*.vtt|*.VTT)
+ $TERMCMD sh -c "curl -s "$clip" | less" &
+ ;;
+ *.gif|*.GIF)
+ curl -s "$clip" | gifview -a - &
+ ;;
+ *)
+ $TERMCMD sacc "$clip" &
+ ;;
+ esac
;;
-gopher://*.gif|gopher://*.GIF|http://*.GIF|https://*.gif)
- curl -L "$clip" | gifview -a -
+
+http://*|https://*)
+ case "$clip" in
+ *.jpg|*.jpeg|*.JPG|*.JPEG|*.png|*.PNG)
+ curl -Ls "$clip" | feh - &
+ ;;
+ *.mp4|*.MP4|*.webm|*.WEBM|*.mkv|*.MKV)
+ mpv "$clip" &
+ ;;
+ *.gif|*.GIF)
+ curl -Ls "$clip" | gifview -a - &
+ ;;
+ *)
+ ff -new-tab "$clip" &
+ ;;
+ esac
;;
-*.gif|*.GIF)
- gifview -a "$clip"
+
+ytdl://*|*www.youtube.com*|*vimeo.com*|*dailymotion.com*)
+ mpv "$clip" &
;;
-http://*|https://*)
- ff --new-tab "$clip"
+
+ssh://*)
+ $TERMCMD ssh "$clip" &
;;
+
*)
logger -s "plumber: no plumber for plumbed data"
exit 1