Does SDKMAN use the binary shim pattern for auto switching? #1200
-
In looking around at language version managers I see lots of people praising jenv nodeenv rbenv for using the binary shim pattern. The advantages seem good. see https://github.com/rbenv/rbenv/wiki/Comparison-of-version-managers and https://github.com/nodenv/nodenv/wiki/Why-nodenv%3F for why those version managers think so. My main question is - how does SDKMAN implement sdkman_auto_env being true on a bash system? I'm not a bash expert and had a tough time understanding the source code. Seems like zsh has some kinda hook SDKMAN taps into for that shell. Looking at this - sdkman-cli/src/main/bash/sdkman-init.sh Line 214 in 5e33c36 Would also love to hear others thoughts on if this shim design pattern is not as good as others say. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
SDKMAN! appends If the current directory ( zsh supports this natively via the |
Beta Was this translation helpful? Give feedback.
SDKMAN! appends
sdkman_auto_env to the
PROMPT_COMMAND` env variable which defines a set of functions which is ran before the prompt is displayed.If the current directory (
PWD
) is different to the last visited directory (SDKMAN_OLD_PWD
) and the directory contains an.sdkmanrc
thensdk env
is executed.zsh supports this natively via the
chpwd_functions
array.