astro

a POSIX shell compatible gemini client (mirror of https://github.com/blmayer/astro)
git clone https://git.clttr.info/astro.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 3fecc5a486b34afffc21bd11fffad6ac824a7285
parent e6d8d38e05dd2c29af49c9139ad49c1fef082312
Author: René Wagner <rwa@clttr.info>
Date:   Sun,  6 Aug 2023 19:18:00 +0200

Merge branch 'main' into trace

Diffstat:
Mastro | 16+++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/astro b/astro @@ -49,7 +49,7 @@ version() { } debug() { - [ "$debug" ] && echo "DEBUG: $*" >&2 && sleep 2 + [ "$debug" ] && echo "DEBUG: $*" >&2 && sleep "$debug" } # Parse arguments @@ -77,8 +77,7 @@ LESSKEY="$confighome/astro/less.keys" certdir="$confighome/astro/certs" mkdir -p "$certdir" -[ -z "$cachehome" ] && cachehome=${XDG_CACHE_HOME:-$HOME/.cache} -cachedir="$cachehome/astro" +cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/astro" # This is the final binary form, to save space, it corresponds to: # o (49): go to a URL @@ -93,12 +92,11 @@ cachedir="$cachehome/astro" [ -n "$LESSKEY" ] && echo "AE0rR2MtAG8AmDEAcgCYMgBnAJgzAGIAmDQASACYNQBtAJg2AE0AmDcASwCYOAB1AJg5AGUAAHYAAHhFbmQ=" | \ base64 -d > "$LESSKEY" -margin=8 if [ ! -s "$configfile" ] then # Default values cat << EOF > "$configfile" -cachedir="$cachehome" +cachedir="$cachedir" margin=8 homepage="gemini.circumlunar.space/" sty_header1='\\033[35;7;1m' @@ -123,7 +121,7 @@ linksfile="$(mktemp -p "$cachedir" -t links.XXXXXX)" tracefile="$(mktemp -p "$cachedir" -t trace.XXXXXX)" # Restore terminal -trap 'tput rmcup && rm -f $histfile $linksfile > /dev/null 2>&1; exit' EXIT INT HUP +trap 'tput rmcup && rm -f $histfile $linksfile $pagefile > /dev/null 2>&1; exit' EXIT INT HUP stop() { [ "$trace" ] || return @@ -178,7 +176,7 @@ parseurl() { typesetgmi() { stop NR=$'\r' - while IFS='' read -r line + while IFS='' read -r line || [ -n "$line" ]; do line="$(echo "$line" | tr -d '\r')" #line="${line%$NR}" @@ -216,12 +214,12 @@ typesetgmi() { '* '*) sty="$sty_listt" && line="$sty_listb$sty_listt$(echo "$line" | cut -c 2-)";; *) sty="";; esac - echo "$line" | sed 's/%/%%/g' | fold -w "$width" -s | { + echo "$line" | fold -w "$width" -s | { while IFS='' read -r txt do printf "%*s" "$margin" "" # shellcheck disable=SC2059 - printf -- "$sty$txt\\n" + echo -e "$sty$txt" done } done