summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorepoch <epoch@hack.thebackupbox.net>2020-10-19 01:36:21 +0000
committerepoch <epoch@hack.thebackupbox.net>2020-10-19 01:36:21 +0000
commit840a373b74a8202801126af195177b9964e8377a (patch)
tree62864d3a982348a6ee940e6aab12a77df34b483d
parentd88e13ca253bd1f2c3acad0dae911f7aa0669dec (diff)
downloaduritools-840a373b74a8202801126af195177b9964e8377a.tar.gz
uritools-840a373b74a8202801126af195177b9964e8377a.zip
added support for gopher links of type 1 and 0
-rwxr-xr-xurititle10
1 files changed, 10 insertions, 0 deletions
diff --git a/urititle b/urititle
index 6367473..7b159da 100755
--- a/urititle
+++ b/urititle
@@ -59,6 +59,16 @@ magnet)
ftp)
curl "$1" 2>&1 | tail -n1
;;
+gopher)
+ type="$(printf "%s\n" "$1" | uricut -p | cut -b2- | cut -b1)"
+ if [ "$type" = 1 -o "$type" = "" ];then
+ printf "title: %s\n" "$(curl -s "$1" | grep ^i | head -n1 | cut -f1 | cut -b2-)"
+ elif [ "$type" = 0 ];then
+ printf "title: %s\n" "$(curl -s "$1" | head -n1)"
+ else
+ printf "title: don't know how to get title of non-1 gopher links"
+ fi
+ ;;
ssh)
if [ ! "$port" ];then
port=22