env/mblaze/mless-key-handler

42 lines
975 B
Plaintext
Raw Permalink Normal View History

2020-03-12 00:25:28 +01:00
#!/bin/sh
# mblaze.env
# Written in 2020 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
keyhandler()
{
case "$1" in
0|1)
exit $1
;;
70) # F flag
mflag -F .
mseq -f : | mseq -S
mseq -C +
;;
82) # R mark read
mflag -S .
mseq -f : | mseq -S
mseq -C +
;;
94) # ^ goto parent
mseq -C '.^' 2>/dev/null
;;
123) # { prev thread
prev=$(mseq .-1 | sed 's/^ *//')
prev_root=$(mseq -c "$prev" = | head -n 1 | sed 's/^ *//')
mseq -C "$prev_root" 2>/dev/null
;;
125) # } next thread
mseq -C "$(mseq .+1: | sed -n '/^[^ <]/{p;q;}')"
;;
esac
}