commit 1e85a6f6bead45f2a67e9bf1a0e438d9e6e74bac (patch)
parent cb75d85e2a26c06e007a4c9e3454e0bbe3fab623
Author: Alex Karle <alex@alexkarle.com>
Date: Mon, 18 Nov 2024 03:22:49 +0100
Add page command to make long menus/content readable
I'm on a roll tonight!
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gc b/gc
@@ -57,7 +57,7 @@ graburl() {
ui() {
while [ -n "$URL" ]; do
- catlike
+ catlike | tee "$BUF"
URL=""
while true; do
@@ -68,11 +68,13 @@ ui() {
l*) cat "$LINKS" ;;
g*) goto ; break ;;
u*) goback ; break ;;
+ p*) ${PAGER:-less} "$BUF" ;;
H*) cat "$HISTORY" ;;
h*) cat <<EOM ;;
NUM -- go to this target
g[oto] -- specify new URL
u[p] -- go up a directory
+p[age] -- view the content in $PAGER
H[istory] -- list the history
h[elp] -- print this message
l[ist] -- list targets
@@ -88,6 +90,7 @@ EOM
URL=$1
LINKS=$(mktemp)
HISTORY=$(mktemp)
+BUF=$(mktemp)
echo "$URL" > "$HISTORY"
if ! tty >/dev/null; then
@@ -96,4 +99,4 @@ else
ui
fi
-rm -f "$LINKS" "$HISTORY"
+rm -f "$LINKS" "$HISTORY" "$BUF"