diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-04-14 11:41:55 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-04-14 11:41:55 +0000 |
| commit | d8bd6a8a31416ffac3b5e6cda2cfb552bd48f9f8 (patch) | |
| tree | 6faf7da6161b2da6f20435d8569de6a706f8410e /bin/alv-copilot | |
| parent | remove love2d leftovers (diff) | |
| download | alive-d8bd6a8a31416ffac3b5e6cda2cfb552bd48f9f8.tar.gz alive-d8bd6a8a31416ffac3b5e6cda2cfb552bd48f9f8.zip | |
rename copilot to alv-copilot
Diffstat (limited to 'bin/alv-copilot')
| -rwxr-xr-x | bin/alv-copilot | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/alv-copilot b/bin/alv-copilot new file mode 100755 index 0000000..68e8ebd --- /dev/null +++ b/bin/alv-copilot @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +tmpdir=$(mktemp -d) +trap 'rm -rf "$tmpdir"' EXIT INT TERM HUP + +ARGS="$@" +FIFO=$tmpdir/fifo +CONF=$tmpdir/conf +LIBDIR=$(dirname $0) +LUA_PATH="$LIBDIR/?.lua;$LIBDIR/?/init.lua;$LUA_PATH" + +cat > "$CONF" << 'EOF' +split +focus +screen -t evaltime sh -c 'tty > "$FIFO"; read done < "$FIFO"' +focus +screen -t runtime sh -c 'read tty < "$FIFO"; moon "$LIBDIR/alv/copilot.moon" $ARGS 2> "$tty"; echo "[press enter to exit]"; read prompt; echo done > "$FIFO"' +EOF + +mkfifo "$FIFO" +export FIFO ARGS LIBDIR LUA_PATH +exec screen -mc "$CONF" |
