| Date: Sun, 2 Apr 2017 08:48:20 +0200
Add ssh:// support. Cut, cut, cut ...
Diffstat:
bin/plumber | 1 +
openers/danceopener | 10 ++++++++++
openers/sshopener | 33 +++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 0 deletions(-)
--- |
| @@ -57,6 +57,7 @@ plumbrules = [
["^rtsp://.*", "mediaopener '%s'"],
["^udp://.*", "mediaopener '%s'"],
["^telnet(s|)(4|6|)://.*", "telnetopener '%s'"],
+ ["^ssh://.*", "sshopener '%s'"],
["^tv://.*", "tvopener '%s'"],
["^yt://.*", "ytopener '%s'"],
["^youtube://.*", "ytopener '%s'"], |
| @@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -x
+
+if [ $# -lt 1 ];
+tthen
+ printf "usage: %s URI\n" "$(basename "$0")" >&2
+ exit 1
+fi
+
+uri="$1"
+
+# »cut, cut, cut, ...« makes the chicken.
+host="$(printf "%s\n" "$uri" \
+ | cut -d ':' -f 2- \
+ | cut -c 3- \
+ | cut -d':' -f 1 \
+ | cut -d'/' -f 1)"
+
+# »cut, cut, cut, ...« makes the turkey.
+port="$(printf "%s\n" "$uri" \
+ | cut -d ':' -f 2- \
+ | cut -c 3- \
+ | cut -s -d':' -f 2- \
+ | cut -d '/' -f 1)"
+t[ -z "$port" ] && port="22"
+
+st -e sh -c \
+ "printf \"URI: %s\n\" "${uri}"; \
+ ssh -p \"${port}\" \"${host}\"; \
+ read;" \
+ 2>&1 >/dev/null &
+ |