diff options
author | Leah Neukirchen <leah@vuxu.org> | 2024-07-03 17:55:45 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2024-07-03 17:58:18 +0200 |
commit | 2bb551efd8b3e50d715482a8f3b89f88bae74397 (patch) | |
tree | d380e8ffaba4e634b6e518480f91f2f37bad72be /nqterm | |
parent | e5861199e018fcc6537fbd4a522aea1f75ec0d4e (diff) | |
download | nq-master.tar.gz nq-master.tar.xz nq-master.zip |
There's only so many two letter binaries that can exist at the same time. A newer project, called fq, arrived and is clashing with nq in many packaging systems, and nqtail is a fine name too.
Diffstat (limited to 'nqterm')
-rwxr-xr-x | nqterm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/nqterm b/nqterm new file mode 100755 index 0000000..06b5741 --- /dev/null +++ b/nqterm @@ -0,0 +1,25 @@ +#!/bin/sh +# nqterm CMD... - tmux/screen wrapper for nq to display output in new window + +set -e + +s=$(nq "$@") +p=${s##*.} + +printf '%s\n' "$s" + +if [ -n "$p" ]; then + if [ -n "$TMUX" ]; then + tmux new-window -a -d -n '<' -c '#{pane_current_path}' \ + "trap true INT QUIT TERM EXIT; + nqtail $s || kill $p; + printf '[%d exited, ^D to exit.]\n' $p; + cat >/dev/null" + elif [ -n "$STY" ]; then + screen -t '<' sh -c "trap true INT QUIT TERM EXIT; + nqtail $s || kill $p + printf '[%d exited, ^D to exit.]\n' $p; + cat >/dev/null" + screen -X other + fi +fi |