diff options
Diffstat (limited to 'config/.bashrc')
| -rw-r--r-- | config/.bashrc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/config/.bashrc b/config/.bashrc index 288d919..9c463dd 100644 --- a/config/.bashrc +++ b/config/.bashrc @@ -11,12 +11,25 @@ function inflate() { fi } +update_java_home() { + local java_path + java_path="$(asdf which java)" + if [[ -n "${java_path}" ]]; then + export JAVA_HOME + JAVA_HOME="$(dirname "$(dirname "$(realpath "${java_path}")")")" + fi +} + function switch_to() { local tool=$1 local major_version=$2 local version version="$(grep "$tool" "$HOME/.tool-versions"| tr ' ' '\n' | grep "^$major_version")" asdf shell "$tool" "$version" + + if [[ "$tool" = "java" ]]; then + update_java_home + fi } function major_version_from() { |
