search.sh 949 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env bash
  2. # Perplexica Search TUI launcher
  3. # Usage: ./search.sh [--mode MODE] [--query QUERY] [--speed SPEED] [other options]
  4. # NOTE: Set VENV_PATH below to your own Python virtual environment path.
  5. set -euo pipefail
  6. # Find the project directory
  7. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  8. VENV_PATH="${VENV_PATH:-$HOME/venv/general}" # <-- Set this to your own venv path if needed
  9. PYTHON_BIN="$VENV_PATH/bin/python3"
  10. APP="$SCRIPT_DIR/perplexica-search-tui.py"
  11. # Check if venv exists
  12. if [[ ! -x "$PYTHON_BIN" ]]; then
  13. echo "Error: Python interpreter not found at $PYTHON_BIN"
  14. echo "Please create the virtual environment at $VENV_PATH"
  15. exit 1
  16. fi
  17. # Check if app exists
  18. if [[ ! -f "$APP" ]]; then
  19. echo "Error: Application not found at $APP"
  20. exit 1
  21. fi
  22. # Activate venv (optional, for subshell)
  23. source "$VENV_PATH/bin/activate"
  24. # Forward all arguments to the Python script
  25. exec "$PYTHON_BIN" "$APP" "$@"