Pipelines!
This commit is contained in:
parent
972508e74d
commit
76594427ff
2 changed files with 26 additions and 7 deletions
10
bin/linewise
Executable file
10
bin/linewise
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ ! -z "${1+x}" ]]; then
|
||||||
|
while read r; do
|
||||||
|
<<< "${r}" "$1"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "No reader program provided."
|
||||||
|
exit 1
|
||||||
|
fi
|
23
bin/pipeline
23
bin/pipeline
|
@ -25,16 +25,21 @@ if [[ ! -e "$transform" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
in="$td/in"
|
in="$td/in"
|
||||||
|
if [[ ! -z "${1+x}" ]]; then
|
||||||
|
in="${1}"; shift
|
||||||
|
fi
|
||||||
out="$td/out"
|
out="$td/out"
|
||||||
|
if [[ ! -z "${1+x}" ]]; then
|
||||||
|
out="${1}"; shift
|
||||||
|
fi
|
||||||
|
|
||||||
chmod +x "$transform"
|
chmod +x "$transform"
|
||||||
echo "Hello World" > "$in"
|
echo "Hello World" > "$in"
|
||||||
|
|
||||||
touch /tmp/ll.log
|
fswi \
|
||||||
FSW_DEBUG=1 fswi \
|
|
||||||
"bash -c '< \"$in\" \"$transform\" > \"$out\"'" \
|
"bash -c '< \"$in\" \"$transform\" > \"$out\"'" \
|
||||||
'in$|transform$' \
|
'in$|transform$' \
|
||||||
"$td" "$pdir" \ &> /tmp/ll.log &
|
"$td" "$pdir" &> /dev/null &
|
||||||
watcher="$!"
|
watcher="$!"
|
||||||
|
|
||||||
if [[ -z ${cleanup_trap+x} ]]; then
|
if [[ -z ${cleanup_trap+x} ]]; then
|
||||||
|
@ -43,13 +48,17 @@ else
|
||||||
trap "${cleanup_trap}; kill \"$watcher\"" EXIT
|
trap "${cleanup_trap}; kill \"$watcher\"" EXIT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
job="call jobstart(['inotifywait', '-m', '-e', 'close_write', '${out}'], {'on_stdout':{j,d,e->execute('checktime')}})"
|
||||||
|
echo "$job"
|
||||||
|
|
||||||
|
# this will only autosave (and therefore autoreload) for the out buffer (since
|
||||||
|
# it was opened last) - autosaving (and therefore autorunning) is potentially
|
||||||
|
# very scary
|
||||||
nvim \
|
nvim \
|
||||||
--cmd 'set shm+=atIWF' \
|
--cmd 'set shm+=atIWF' \
|
||||||
--cmd 'set shm-=Oo' \
|
--cmd 'set shm-=Oo' \
|
||||||
-o "$in" "$transform" "$out" \
|
-o "$in" "$transform" "$out" \
|
||||||
--cmd 'set autoread' \
|
--cmd 'set autoread' \
|
||||||
--cmd 'set updatetime=250' \
|
--cmd 'set updatetime=250' \
|
||||||
--cmd 'autocmd CursorHold,CursorHoldI <buffer> silent write'
|
--cmd 'autocmd CursorHold,CursorHoldI <buffer> silent write' \
|
||||||
--cmd 'autocmd BufWrite * sleep 500m | checktime'
|
--cmd "$(<<< "$job" tr "'" '"')"
|
||||||
|
|
||||||
# TODO: vim set autoread
|
|
||||||
|
|
Reference in a new issue