todotxt-to-html/watch_todo.sh
2025-06-22 01:02:10 -07:00

19 lines
386 B
Bash
Executable File

#!/bin/bash
cd "$(dirname "$0")"
if [ ! -d ".venv" ]
then
python -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
else
. .venv/bin/activate
fi
name="$(basename "$(basename "$1")" .txt)"
echo "Watching $1 and writing to $2/$name.html"
while true
do
./todotxt-to-html.py - "$name" < "$1" > "$2/$name.html" &
inotifywait -e close_write "$1"
done