From 0f48a20ea95e520768db3516f73ac0437a973935 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 12 May 2020 14:25:49 +1200 Subject: Add an idea about urlmt(1df) --- IDEAS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IDEAS.md b/IDEAS.md index 7622dd97..cb7e4a74 100644 --- a/IDEAS.md +++ b/IDEAS.md @@ -34,3 +34,4 @@ Ideas * There's no reason to limit `digraph_search.vim` to insert mode only * fortune.vim can be spun out into its own repository * put\_date.vim can be spun out into its own repository +* urlmt(1df) would be better off using `curl -w '%{content_type}'` -- cgit v1.2.3 From 30883b70ad9e7ebf06b75f7e63b7b2205052a2d9 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 12 May 2020 14:59:22 +1200 Subject: Use `curl -w` for getting media type Much nicer. --- bin/urlmt.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/urlmt.sh b/bin/urlmt.sh index cd71b0fd..69bef5f7 100644 --- a/bin/urlmt.sh +++ b/bin/urlmt.sh @@ -1,8 +1,10 @@ # Get the MIME type for a given URL -urlh "$1" Content-Type | - -# Use last line only, remove any charset suffix -sed ' -$!d -s/;.*// -' +self=urlmt +if [ "$#" -ne 1 ] || [ -z "$1" ] ; then + printf >&2 '%s: Need a single URL\n' \ + "$self" + exit 2 +fi +url=$1 +curl --head --output /dev/null --write-out '%{content_type}\n' "$url" | + awk -F\; '{print $1}' -- cgit v1.2.3 From e0e8fe332d135f6dc4b14004adeec80943a52a48 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 12 May 2020 15:01:11 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 9eb40434..52d99110 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v8.34.0 -Mon, 11 May 2020 11:49:11 +0000 +tejr dotfiles v8.35.0 +Tue, 12 May 2020 03:01:11 +0000 -- cgit v1.2.3