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 ba0c1f996d3305af251c4ed738266c968196aa65
parent 1fdc7e9c4dac4e657356ba3bc13789f01cd7aa97
Author: Sotiris Papatheodorou <sotiris@papatheodorou.xyz>
Date:   Mon, 16 Aug 2021 00:39:00 +0300

Fix literal backslashes

SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e".
https://github.com/koalaman/shellcheck/wiki/SC1117

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

diff --git a/astro b/astro @@ -176,30 +176,30 @@ fetch() { # Add margins and fold if [ "$pre" = 1 ] then - printf "%*s%s\n" "$margin" "" "$line" + printf '%*s%s\n' "$margin" "" "$line" else case "$line" in - "### "*) sty="\e[35;1m" && line="$(echo "$line" | cut -c 5- )" ;; - "## "*) sty="\e[35;4m" && line="$(echo "$line" | cut -c 4-)" ;; - "# "*) sty="\e[35;4;1m" && line="$(echo "$line" | cut -c 3-)" ;; - "> "*) sty=" \e[2;3m" && line="$(echo "$line" | cut -c 3-)" ;; + "### "*) sty='\e[35;1m' && line="$(echo "$line" | cut -c 5- )" ;; + "## "*) sty='\e[35;4m' && line="$(echo "$line" | cut -c 4-)" ;; + "# "*) sty='\e[35;4;1m' && line="$(echo "$line" | cut -c 3-)" ;; + "> "*) sty=' \e[2;3m' && line="$(echo "$line" | cut -c 3-)" ;; "=>"*) link="$(echo "$line" | sed -e 's/^=> *\(\S\+\)\(\s*.*\)/\1 \2/g')" echo "$link" >> "$cachedir/links.txt" line="$(echo $link | cut -d' ' -f2-)" [ -z "$line" ] && line="$link" - sty="\e[36;3m" - line="\e[35m=>\e[36;3m $line" + sty='\e[36;3m' + line="\\e[35m=>\\e[36;3m $line" ;; - '* '*) sty="" && line="\e[35;1m •\e[0m$(echo "$line" | cut -c 2-)";; + '* '*) sty="" && line="\\e[35;1m •\\e[0m$(echo "$line" | cut -c 2-)";; *) sty="";; esac echo "$line" | fold -w $width -s | { while IFS='' read -r txt do printf "%*s" "$margin" "" - printf "$sty$txt\n" + printf "$sty$txt\\n" done } fi