Files
cleveragents-core/scripts/load-tool-versions.sh
T

28 lines
808 B
Bash
Executable File

#!/bin/bash
# Load tool versions from .tool-versions file
# This script sources the .tool-versions file and exports the variables
set -e
TOOL_VERSIONS_FILE=".tool-versions"
if [ ! -f "$TOOL_VERSIONS_FILE" ]; then
echo "ERROR: $TOOL_VERSIONS_FILE not found"
exit 1
fi
# Source the tool versions file
# This exports all TOOL_NAME=version pairs as environment variables
while IFS='=' read -r key value; do
# Skip empty lines and comments
[[ -z "$key" || "$key" =~ ^# ]] && continue
# Trim whitespace
key=$(echo "$key" | xargs)
value=$(echo "$value" | xargs)
export "$key=$value"
done < "$TOOL_VERSIONS_FILE"
# Output the loaded versions for verification
echo "Loaded tool versions from $TOOL_VERSIONS_FILE:"
grep -v '^#' "$TOOL_VERSIONS_FILE" | grep -v '^$' | sed 's/^/ /'