add run.sh wrapper for uv

This commit is contained in:
ivanberry 2026-03-16 21:37:51 +08:00
parent 8a2123f605
commit dee3a429b6
1 changed files with 21 additions and 0 deletions

21
run.sh Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
if ! command -v uv &> /dev/null; then
echo "❌ uv not found" >&2
exit 1
fi
[ ! -d ".venv" ] && uv sync
SCRIPT_NAME="$1"
shift
if [ -z "$SCRIPT_NAME" ]; then
echo "Usage: ./run.sh <script> [args...]"
ls scripts/*.py | xargs -n1 basename | sed 's/\.py$//' | sed 's/^/ /'
exit 1
fi
uv run python "scripts/${SCRIPT_NAME}.py" "$@"