-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.sh
More file actions
executable file
·37 lines (28 loc) · 1.11 KB
/
app.sh
File metadata and controls
executable file
·37 lines (28 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Wrapper script to run alfred-pj with uv-managed environment
set -e
# Ensure ~/.local/bin is in PATH
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
# Add Obsidian CLI to PATH (official CLI bundled with Obsidian.app)
if [[ ":$PATH:" != *":/Applications/Obsidian.app/Contents/MacOS:"* ]]; then
export PATH="$PATH:/Applications/Obsidian.app/Contents/MacOS"
fi
# Check if uv is available, install if not
if ! command -v uv &> /dev/null; then
echo "uv not found, installing to ~/.local/bin..." >&2
mkdir -p "$HOME/.local/bin"
curl -LsSf https://astral.sh/uv/install.sh | sh -s -- --no-modify-path
fi
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Sync dependencies only when uv.lock is newer than the venv or the venv is missing
VENV_DIR="$SCRIPT_DIR/.venv"
LOCK_FILE="$SCRIPT_DIR/uv.lock"
PYVENV="$VENV_DIR/pyvenv.cfg"
if [[ ! -f "$PYVENV" ]] || [[ "$LOCK_FILE" -nt "$PYVENV" ]]; then
uv sync --project "$SCRIPT_DIR"
fi
# Run the application
uv run --project "$SCRIPT_DIR" alfred-pj "$@"