hbbs

bbs.hlirc.net
Log | Files | Refs | README | LICENSE

commit 4ea5fcfa5dc9c9954bb0a8538e588c9c4f0ec533
parent 833b794754258818dc051f4fd04cccbecaaf32f1
Author: hhvn <hayden@haydenvh.com>
Date:   Mon,  1 Feb 2021 12:31:04 +0000

etc/intro bin/interface.sh: add default commands to run if none is given

Diffstat:
Mbin/interface.sh | 16+++++++++++++---
Metc/intro | 6+++++-
2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/bin/interface.sh b/bin/interface.sh @@ -43,7 +43,7 @@ menu_boards(){ do parse_in "$input" case "$cmd" in - x) page=$(($page+1)); break ;; + x|"") page=$(($page+1)); break ;; p) page=$(($page-1)); break ;; s) [ "$arg" = "" ] && prompt "board" arg @@ -89,7 +89,7 @@ menu_list(){ do parse_in "$input" case "$cmd" in - x) page=$(($page+1)); break ;; + x|"") page=$(($page+1)); break ;; p) page=$(($page-1)); break ;; b) set_mode boards; break ;; o) break ;; @@ -168,15 +168,19 @@ menu_read(){ parse_in "$input" case "$cmd" in x) + oldid="$id" id=$(awk -v "file=$(echo "$file" | sed 's/ .*//')" -v "id2=$id2" -F" " '$6 == file && ($2 - 1) == id2 {print $1"."$2}' < $datadir/boards/$board/list) [ "$id" = "" ] && { error "already on last message in thread" + id="$oldid" } || break ;; p) + oldid="$id" id=$(awk -v "file=$(echo "$file" | sed 's/ .*//')" -v "id2=$id2" -F" " '$6 == file && ($2 + 1) == id2 {print $1"."$2}' < $datadir/boards/$board/list) [ "$id" = "" ] && { error "already on first message in thread" + id="$oldid" } || break ;; b) set_mode boards; break ;; @@ -222,6 +226,12 @@ menu_read(){ (help varies depending on current menu) EOF ;; + "") + oldid="$id" + id=$(awk -v "file=$(echo "$file" | sed 's/ .*//')" -v "id2=$id2" -F" " '$6 == file && ($2 - 1) == id2 {print $1"."$2}' < $datadir/boards/$board/list) + [ "$id" = "" ] && set_mode boards && id="$oldid" + break + ;; *) error "unrecognized command" ;; esac done @@ -237,7 +247,7 @@ menu_users(){ do parse_in "$input" case "$cmd" in - x) page=$(($page+1)); break ;; + x|"") page=$(($page+1)); break ;; p) page=$(($page-1)); break ;; i) [ ! -f $datadir/users/${arg:-$user} ] && error "no such user" && break diff --git a/etc/intro b/etc/intro @@ -9,6 +9,8 @@ then the argument, and hit enter. Most commands that take arguments should also give you a prompt if you don't give it an argument - however there may be some that are overlooked, so you are best not to wait for a prompt. + Any command marked in red is guaranteed to fail if run. (e,g, 'x' will not + work if you are on the last reply). 2. Writing Attempt to limit each line you write to 80 characters. The row of equals @@ -22,7 +24,9 @@ The *s* command doesn't require you to type out the entire board name, the first character should suffice (unless there are boards with names that begin with the same character). To view the first message in the thread, the sub-id - isn't necessary, eg: 'r 1' will work like 'r 1.0'. + isn't necessary, eg: 'r 1' will work like 'r 1.0'. Pressing enter with no + command will work like the 'x' command, except if you are on the last reply, + where it will instead act like 'a'. hbbs is licensed under the ISC code: git://haydenvh.com/hbbs