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 37e3efbdfabc4af1298de0f96c588e628854dddd
parent 131ac2a47f30375e0b6b51092d007c208f7b245c
Author: blmayer <git@myr.sh>
Date:   Tue, 12 Sep 2023 14:27:36 -0300

Lint

Diffstat:
Mastro | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/astro b/astro @@ -219,6 +219,7 @@ typesetgmi() { continue fi + # shellcheck disable=SC2154 case "$line" in "### "*) sty="$sty_header3" && line="${line#'### '}" ;; "## "*) sty="$sty_header2" && line="${line#'## '}" ;; @@ -254,7 +255,7 @@ pager() { # lines columns l="$(tput lines)" head -n "$((l-1))" "$1" - lines="$(cat "$1" | wc -l)" + lines="$(wc -l < "$1")" if [ "$l" -lt "$lines" ]; then pos="$l"; else pos="$lines"; fi # unhide \e[?25h @@ -317,7 +318,9 @@ pager() { # pos="$end" # ;; esac ;; + # shellcheck disable=SC2154 "$quitkey") exit 0 ;; + # shellcheck disable=SC2154 "$openkey") printf '\e[?25h\e[2KType url: ' stty echo icanon @@ -332,7 +335,9 @@ pager() { # read -r url <&1 # return # ;; + # shellcheck disable=SC2154 "$refreshkey") return ;; + # shellcheck disable=SC2154 "$gokey") printf '\e[?25hEnter link number: ' stty echo icanon @@ -341,6 +346,7 @@ pager() { url="$(sed "${i}q;d" "$linksfile" | cut -f1 | cut -d' ' -f1)" return ;; + # shellcheck disable=SC2154 "$backkey") read -r proto host port path <<- EOF $(getprevious) @@ -348,7 +354,9 @@ pager() { url="$proto://$host:$port/$path" return ;; + # shellcheck disable=SC2154 "$homekey") url="$homepage"; return ;; + # shellcheck disable=SC2154 "$markkey") printf '\e[?25h\e[KEnter description: (optional)' stty echo icanon @@ -356,6 +364,7 @@ pager() { echo "$url $desc" >> "$bookmarkfile" return ;; + # shellcheck disable=SC2154 "$gomarkkey") clear cat -n "$bookmarkfile" @@ -365,11 +374,13 @@ pager() { url="$(sed "${i}q;d" "$bookmarkfile" | cut -d' ' -f1)" return ;; + # shellcheck disable=SC2154 "$delmarkkey") grep -iv "^$url " "$bookmarkfile" > "$cachedir/bookmarks" mv "$cachedir/bookmarks" "$bookmarkfile" return ;; + # shellcheck disable=SC2154 "$goupkey") newpath=$(echo "$url" | rev | cut -d'/' -f2- | rev) url="${url%/*}/$newpath"