commit dd7d7a7c3fd5cd59ca2255ba741ea05b68f2ff61 parent 4994b68fec304ce4c20f133be8c95f4243d8409a Author: pyratebeard <root@pyratebeard.net> Date: Fri, 1 Dec 2023 22:47:59 +0000 remove bin/bin mailfmt*, now in mutt/bin Diffstat:
D | bin/bin/mailfmt | | | 9 | --------- |
D | bin/bin/mailfmtshort | | | 28 | ---------------------------- |
2 files changed, 0 insertions(+), 37 deletions(-)
diff --git a/bin/bin/mailfmt b/bin/bin/mailfmt @@ -1,9 +0,0 @@ -#!/bin/sh - -w=$(tput cols) -if [ -z "$w" ] || [ "$w" -gt 120 ] ; then - w=120 -fi - -# trim mutt [-- Attachment --] headers -grep -vE -- '\[-- .* --\]$' | fmt -s -w $w diff --git a/bin/bin/mailfmtshort b/bin/bin/mailfmtshort @@ -1,28 +0,0 @@ -#!/bin/sh -# use shortner running on lxc container urlshort - -w=$(tput cols) -if [ -z "$w" ] || [ "$w" -gt 120 ] ; then - w=120 -fi - -tmp1=$(mktemp -p /tmp mailfmt.XXXXXXXX) -tmp2=$(mktemp -p /tmp mailfmt.XXXXXXXX) -trap "rm -f $tmp1 $tmp2" EXIT QUIT INT - -# trim mutt [-- Attachment --] headers -grep -vE -- '\[-- .* --\]$' | fmt -s -w $w | tee $tmp1 > $tmp2 - -grep -oE '[hH][tT]{2}[pP][sS]?://([^/?#><"]+)([^?#><"]*)(\?([^#><"]*))?(#(.*))?' $tmp1 | sort | uniq | while read url; do - if [ "$(echo $url | wc -c)" -gt $w ]; then - # shorten url - short=$(curl -sS -X PUT -d "$url" http://s.rum.sh) - - # escape special chars in url for passing it to sed - escape=$(printf '%s\n' "$url" | sed 's/[]\/$*.^[]/\\&/g') - - # replace url with short link (using space as sed separator) - sed -i "s $escape $short g" $tmp2 - fi -done -cat $tmp2