#!/usr/bin/env bash
set -euo pipefail

if command -v watchexec >/dev/null 2>&1; then
  exec watchexec \
    --restart \
    --clear \
    --watch src \
    --watch Cargo.toml \
    --watch Cargo.lock \
    --exts rs,toml,lock \
    -- cargo run -- "$@"
fi

cat >&2 <<'EOF'
watchexec is required for tissues TUI reloads.

Install it, then rerun this command:

  cargo install watchexec-cli

Then start the interactive TUI in this normal terminal:

  ./scripts/dev-tui owner/tissues

Keep bacon in a different terminal for checks. Do not run the full TUI inside bacon.
EOF

exit 1
