run directory: cd '{{directory}}' && gleam run watch directory: #!/usr/bin/env sh cd '{{directory}}' start_gleam() { gleam run & } stop_beam() { BEAM_PID=$(pgrep -f beam.smp) if [ -n "${BEAM_PID}" ]; then kill "${BEAM_PID}" wait "${BEAM_PID}" 2>/dev/null fi } if ! command -v inotifywait >/dev/null; then echo "error: inotifywait could not be found. please install inotify-tools." exit 1 fi start_gleam while inotifywait -r -e modify,create,delete,move src; do stop_beam sleep 1 start_gleam done