commit eecb76bda5c67dadf0b138546c841ca099fdc857
parent 5ee5b11d1bbccd67eabd88c8e1ef36d4fff21a7d
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Sun, 8 Oct 2023 08:24:51 -0700
Allow threading messages other than c
Diffstat:
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/local/bin/bin/thread b/local/bin/bin/thread
@@ -12,9 +12,9 @@ usage() {
name="${0##*/}"
echo "${1:+"error: $1
-"}usage: $name
- $name next
- $name prev" 1>&2
+"}usage: $name [-message]
+ $name [-message] next
+ $name [-message] prev" 1>&2
exit 1
}
@@ -23,7 +23,7 @@ list() {
}
tpick() {
- pick -thread c
+ pick -thread "${@:-c}"
}
tscan() {
@@ -31,15 +31,21 @@ tscan() {
}
tnext() {
- list -thread c | awk 'NF > 1 { getline; print; exit }' |
+ list -thread "${@:-c}" | awk 'NF > 1 { getline; print; exit }' |
xargs show
}
tprev() {
- list -thread c | awk 'NF > 1 { print last; exit } { last = $0 }' |
+ list -thread "${@:-c}" | awk 'NF > 1 { print last; exit } { last = $0 }' |
xargs show
}
+case "$1" in
+(-*)
+ m="${1#-}"
+ shift
+esac
+
case $# in
(0)
f=tpick ;;
@@ -54,4 +60,4 @@ case $# in
usage 'Too many arguments'
esac
-$f
+$f ${m:+"$m"}