gem.awk

A gemini client in POSIX awk
git clone git://git.vgx.fr/gem.awk
Log | Files | Refs

commit 949f6e757e70999ccc9216d11ab39691a15cc77d
parent f3691d33398b058fc810a0ab3793a9df314b52cf
Author: Léo Villeveygoux <l@vgx.fr>
Date:   Thu,  4 Jun 2020 02:16:56 +0200

Add . (reload) and .. (got to parent) commands

Diffstat:
Mgem.awk | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/gem.awk b/gem.awk @@ -92,6 +92,8 @@ function help() { print "The following commands are available:" print " gemini://\033[3;4m.*\033[0m : open a gemini URL" print " \033[3;4mn\033[0m : follow link \033[3;4mn\033[0m of current text/gemini page" + print " . : reload current page" + print " .. : go to parent" print " toc : list titles in a text/gemini page" print " links : list URLs linked in a text/gemini page" print " help : show this help" @@ -127,6 +129,26 @@ $1 ~ /^[[:digit:]]+$/ { } } +/^\.$/ { + if (CURRENT_URL) + gemini_url_open(CURRENT_URL) + else + print "No current page to reload." +} + +/^\.\.$/ { + if (CURRENT_URL) { + parent_url=CURRENT_URL + sub(/\/[^\/]*\/?$/, "/", parent_url) + if (parent_url == "gemini://") + print "Already at site root." + else + gemini_url_open(parent_url) + } + else + print "No current page." +} + $1 == "toc" { if (!PAGE_TITLE_NUM) { print "No title found."