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 72f0bafa05d5150d77183050a181b6bcdd408f2d
parent c6698775e0fdd297670094c3625eb55670911733
Author: René Wagner <rwa@clttr.info>
Date:   Sun, 22 Jan 2023 14:41:00 +0100

add u command to jump one path segment up

Diffstat:
MREADME.md | 1+
Mastro | 16++++++++++++----
Mless.keys | 2+-
3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md @@ -45,6 +45,7 @@ To remove a certificate simply delete the `<domain>.crt` and `<domain>.key` file ### Key bindings - `b` to go back one page +- `u` go one path segment up - `o` to open a new URL, you'll be prompted to type it - `r` to reload the page - `H` to go to the home page diff --git a/astro b/astro @@ -1,7 +1,9 @@ #!/bin/sh +version="0.19.0" + usage() { - echo "Astro v0.18.0: Browse the gemini web on the terminal." + echo "astro v$version: Browse the gemini web on the terminal." echo "" echo "Usage: astro [url]|[option]" echo "" @@ -14,6 +16,7 @@ usage() { echo " g go to a link" echo " r reload current page" echo " b go back one page" + echo " u jump one path segment up" echo " o open an address" echo " s save current page" echo " H go to homepage" @@ -36,7 +39,7 @@ usage() { } version() { - echo "astro 0.18.0" + echo "astro $version" echo "Copyright (C) 2021-2023 Brian Mayer." echo "License MIT: MIT License <https://opensource.org/licenses/MIT>" echo "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND," @@ -87,7 +90,8 @@ cachedir="$cachehome/astro" # m (54): add page to bookmarks # M (55): go to a bookmark # K (56): remove bookmark for current url -[ -n "$LESSKEY" ] && echo "AE0rR2MoAG8AmDEAcgCYMgBnAJgzAGIAmDQASACYNQBtAJg2AE0AmDcASwCYOABlAAB2AAB4RW5k" | \ +# u (57): jump one path element up +[ -n "$LESSKEY" ] && echo "AE0rR2MtAG8AmDEAcgCYMgBnAJgzAGIAmDQASACYNQBtAJg2AE0AmDcASwCYOAB1AJg5AGUAAHYAAHhFbmQ=" | \ base64 -d > "$LESSKEY" if [ ! -s "$configfile" ] @@ -404,13 +408,17 @@ EOF cat "$bookmarkfile" | grep -iv "^$url " > "$cachedir/bookmarks" mv "$cachedir/bookmarks" "$bookmarkfile" ;; + 57) + newpath=$(echo "/$4" | rev | cut -d'/' -f2- | rev) + url="$1://$2:$3/$newpath" + ;; esac debug "new url: $url" } # Execution -export LESS='-P Keys\: qgrbosHmMK, to see a description run astro -h' +export LESS='-P Keys\: qgrubosHmMK, to see a description run astro -h' # First request url="${args:-$homepage}" diff --git a/less.keys b/less.keys @@ -7,4 +7,4 @@ H quit 5 m quit 6 M quit 7 K quit 8 - +u quit 9