# frm initialization for bash
# Add to ~/.bashrc or ~/.bash_profile:
#   eval "$(frm env bash)"

__frm_use() {
    local version="$1"
    if [ -z "$version" ]; then
        version=$(cat "{{base_dir}}/default" 2>/dev/null)
    fi
    if [ -n "$version" ] && [ -d "{{base_dir}}/versions/$version/sbin" ]; then
        export PATH="{{base_dir}}/versions/$version/sbin:${PATH//*{{base_dir}}\/versions\/*/}"
        export RABBITMQ_HOME="{{base_dir}}/versions/$version"
    fi
}

# Load default version if set
__frm_use
