File: nqterm

package info (click to toggle)
nq 1.0-0.2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 152 kB
  • sloc: ansic: 539; sh: 169; makefile: 28
file content (25 lines) | stat: -rwxr-xr-x 564 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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