summary refs log tree commit diff
path: root/tq
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-07-31 15:45:30 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-07-31 15:45:30 +0200
commit80a48d82b0b7568108382ecd28fc281e249ac547 (patch)
treea21ad832e51bc08f98eb6e2dd307a52dd469416e /tq
parent9fa8486900284d78b8255b2116af9a0b0ef11a46 (diff)
downloadnq-80a48d82b0b7568108382ecd28fc281e249ac547.tar.gz
nq-80a48d82b0b7568108382ecd28fc281e249ac547.tar.xz
nq-80a48d82b0b7568108382ecd28fc281e249ac547.zip
add tq
Diffstat (limited to 'tq')
-rwxr-xr-xtq17
1 files changed, 17 insertions, 0 deletions
diff --git a/tq b/tq
new file mode 100755
index 0000000..88c6d87
--- /dev/null
+++ b/tq
@@ -0,0 +1,17 @@
+#!/bin/sh
+# tq CMD... - tmux wrapper for nq to display output in new window
+
+set -e
+
+s=$(nq "$@")
+p=${s##*.}
+
+printf '%s\n' "$s"
+
+if [ -n "$p" ] && [ -n "$TMUX" ]; then
+        tmux new-window -a -d -n '<' -c '#{pane_current_path}' \
+                "trap true INT QUIT TERM EXIT;
+                 tail -F --pid=$p $s || kill $p;
+                 printf '[%d exited, ^D to exit.]\n' $p;
+                 cat >/dev/null"
+fi