Add plugin for osx to list all jvm

pull/1362/head
trmaphi 2019-04-13 12:01:27 +07:00
parent 191e4951b2
commit 2cffc04ae1
1 changed files with 20 additions and 0 deletions

View File

@ -111,5 +111,25 @@ function refresh-launchpad() {
fi fi
} }
function list-jvms(){
about 'List java virtual machines and their states in macOS'
example 'list-jvms'
group 'osx'
JDKS_DIR="/Library/Java/JavaVirtualMachines"
JDKS=( $(ls ${JDKS_DIR}) )
JDKS_STATES=()
# Map state of JDK
for (( i = 0; i < ${#JDKS[@]}; i++ )); do
if [[ -f "${JDKS_DIR}/${JDKS[$i]}/Contents/Info.plist" ]]; then
JDKS_STATES[${i}]=enable
else
JDKS_STATES[${i}]=disable
fi
echo "${i} ${JDKS[$i]} ${JDKS_STATES[$i]}"
done
}
# Make this backwards compatible # Make this backwards compatible
alias pcurl='prevcurl' alias pcurl='prevcurl'