| 1 | #!/usr/bin/env bash |
| 2 | # play — wrapper that installs itself on first run and calls kew |
| 3 | |
| 4 | # Run chmod +x play |
| 5 | # Then ./play |
| 6 | # You can now run commands like: play nirvana and it will automatically play all your nirvana, |
| 7 | # which was the original intent of kew |
| 8 | |
| 9 | set -euo pipefail |
| 10 | |
| 11 | INSTALL_DIR="$HOME/.local/bin" |
| 12 | INSTALL_PATH="$INSTALL_DIR/play" |
| 13 | |
| 14 | # Self-install if not already in PATH |
| 15 | if ! command -v play >/dev/null 2>&1 || [ "$(command -v play)" != "$INSTALL_PATH" ]; then |
| 16 | echo "Installing play to $INSTALL_PATH..." |
| 17 | mkdir -p "$INSTALL_DIR" |
| 18 | cp "$0" "$INSTALL_PATH" |
| 19 | chmod +x "$INSTALL_PATH" |
| 20 | echo "✅ Installed play. Run it again from anywhere next time." |
| 21 | fi |
| 22 | |
| 23 | # kew should already be in PATH |
| 24 | exec kew "$@" |