Created
December 16, 2025 12:02
-
-
Save torbbang/584392f06ef5777bdd71d377c0a12f5d 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-agent: Interactively select a Vibe configuration directory | |
| # Usage: source set-agent (or . set-agent) | |
| # Check if script is being sourced | |
| if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then | |
| echo "β οΈ This script must be sourced to set VIBE_HOME in your current shell." | |
| echo "Usage: source set-agent" | |
| echo " or: . set-agent" | |
| exit 1 | |
| fi | |
| ALT_CONFIGS_DIR="$HOME/.vibe/alt-configs" | |
| if [[ ! -d "$ALT_CONFIGS_DIR" ]]; then | |
| echo "β Error: $ALT_CONFIGS_DIR does not exist" | |
| return 1 | |
| fi | |
| # Get list of directories | |
| configs=() | |
| while IFS= read -r -d '' dir; do | |
| configs+=("$(basename "$dir")") | |
| done < <(find "$ALT_CONFIGS_DIR" -mindepth 1 -maxdepth 1 -type d -print0 | sort -z) | |
| if [[ ${#configs[@]} -eq 0 ]]; then | |
| echo "π No configurations found in $ALT_CONFIGS_DIR" | |
| return 1 | |
| fi | |
| # Add option to use default config | |
| configs+=("default (~/.vibe)") | |
| echo "π§ Available Vibe configurations:" | |
| select config in "${configs[@]}"; do | |
| if [[ -n "$config" ]]; then | |
| if [[ "$config" == "default (~/.vibe)" ]]; then | |
| unset VIBE_HOME | |
| echo "β¨ Using default Vibe configuration (~/.vibe)" | |
| else | |
| export VIBE_HOME="$ALT_CONFIGS_DIR/$config" | |
| echo "π VIBE_HOME set to: $VIBE_HOME" | |
| fi | |
| break | |
| else | |
| echo "β Invalid selection. Please try again." | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment