# Fish Maven Environment Switch - {{env_name}}
# Generated by fnva

# Clean previous fnva-managed path, then set new MAVEN_HOME / M2_HOME
if set -q FNVA_MAVEN_BIN
    set -gx PATH (string match -v "^$FNVA_MAVEN_BIN\$" $PATH)
end
set -gx FNVA_MAVEN_BIN "{{maven_bin}}"
set -gx MAVEN_HOME "{{maven_home}}"
set -gx M2_HOME "{{maven_home}}"
set -gx PATH "{{maven_bin}}" $PATH

# Set MAVEN_OPTS (clear previous then apply this environment's config)
{{#if has_maven_opts}}
set -gx MAVEN_OPTS "{{maven_opts_value}}"
{{else}}
set -e MAVEN_OPTS
{{/if}}

# Set fnva environment tracking
set -gx FNVA_CURRENT_MAVEN "{{env_name}}"
set -gx FNVA_ENV_TYPE "Maven"

# Verify the switch
if not set -q _FNVA_QUIET
    printf '\033[32m✓\033[0m Switched to Maven: {{env_name}}\n'
end
