commit 25902314e01f7022d5a8ac108ea0353d7a6586bf parent 2b169065c9ca406958f661dba736cbb89d479181 Author: William Casarin <jb55@jb55.com> Date: Mon, 28 Dec 2020 11:54:06 -0800 plainweb: simplify Diffstat:
M | bin/plainweb | | | 15 | +++++++++++---- |
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/bin/plainweb b/bin/plainweb @@ -1,10 +1,17 @@ #!/usr/bin/env bash -if [ -z "$2" ]; then - printf "usage: plainweb <url> <out.txt>\n" +if [ -z "$1" ]; then + printf "usage: plainweb <url>\n" exit 1 fi -curl -sL "$1" | pandoc -f html -t plain - -o "$2" +HURL="/tmp/$(sha256sum <<<"$1" | awk '{print $1}').txt" +OUT=${2:-$HURL} + +if [ ! -f "$HURL" ]; then + curl -sL "$1" | pandoc -f html -t plain - -o "$HURL" +fi + +exec lessr "$HURL" + -exec lessr "$2"