Last active
February 21, 2026 10:05
-
-
Save marcraminv/e269ae36f32bf4bd233273dbfd02c788 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # ── Plugin list: "name url" (url is optional) ───────────────────────────────── | |
| PLUGINS=( | |
| "uv" | |
| "bun" | |
| "nodejs" | |
| "kubectl" | |
| "helm" | |
| "direnv" | |
| ) | |
| # ── Add plugins ─────────────────────────────────────────────────────────────── | |
| for entry in "${PLUGINS[@]}"; do | |
| plugin="${entry%% *}" | |
| url="${entry#* }" | |
| [[ "${url}" == "${plugin}" ]] && url="" | |
| if asdf plugin list | grep -q "^${plugin}$"; then | |
| echo "Plugin '${plugin}' already added, skipping." | |
| else | |
| echo "Adding plugin: ${plugin}" | |
| asdf plugin add "${plugin}" ${url:+"${url}"} | |
| fi | |
| done | |
| # ── Install tool versions ───────────────────────────────────────────────────── | |
| install_tool() { | |
| local plugin="$1" | |
| local version | |
| version=$(asdf latest "${plugin}") | |
| echo "Installing ${plugin} ${version}..." | |
| asdf install "${plugin}" "${version}" | |
| asdf set --home "${plugin}" "${version}" | |
| } | |
| if [[ -f ".tool-versions" ]]; then | |
| echo "Found .tool-versions — installing pinned versions..." | |
| asdf install | |
| else | |
| echo "No .tool-versions found — installing latest stable versions..." | |
| for entry in "${PLUGINS[@]}"; do | |
| install_tool "${entry%% *}" | |
| done | |
| fi | |
| # ── Configure direnv in .zshrc ──────────────────────────────────────────────── | |
| if ! grep -q 'direnv hook' "${HOME}/.zshrc" 2>/dev/null; then | |
| echo 'eval "$(direnv hook zsh)"' >> "${HOME}/.zshrc" | |
| echo "direnv hook added to ~/.zshrc" | |
| else | |
| echo "direnv hook already present in ~/.zshrc, skipping." | |
| fi | |
| echo "" | |
| echo "✅ All done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment