Last active
November 2, 2020 10:14
-
-
Save inoperable/8d29907bd58d1298207b3a70960ec03a to your computer and use it in GitHub Desktop.
sdkman to fzf quick and dirty selection of installed JDKS with fzf in zsh (should work also in bash, i guess)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assuming sdkman is installed in default location: $HOME/.sdkman | |
# grep selects only from INSTALLED candidates | |
# | |
# add to your .zshrc or .zshrc.local or save it as use-jdk.zsh and | |
# load it on init with 'source ~/PATH/TO/SCRIPT/use-jdk.zsh' | |
function use-jdk() { | |
FUNCS=$(functions sdk); | |
sdk ls java | grep installed | grep -Po "\|\s\d+.*|" | gawk '{ print $8 }' | fzf -e | xargs -I{} zsh -c "eval $FUNCS; . ~/.sdkman/bin/sdkman-init.sh; sdk default java {}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment