#!/usr/bin/env sh
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
if [ "${1:-}" = "" ] || [ "${1:-}" = "tui" ]; then
  if [ -n "${ELDLOCK_TUI_RUNTIME:-}" ]; then
    exec "$ELDLOCK_TUI_RUNTIME" "$SCRIPT_DIR/../eldlock-cli/dist/main.js" "$@"
  fi
  if command -v bun >/dev/null 2>&1; then
    exec bun "$SCRIPT_DIR/../eldlock-cli/dist/main.js" "$@"
  fi
fi
exec node "$SCRIPT_DIR/../eldlock-cli/dist/main.js" "$@"
