Manage your Java environment
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

66 lines
981 B

#!/usr/bin/env bash
# Summary: List available plugins
# Usage: jenv plugins
set -e
[ -n "$JENV_DEBUG" ] && set -x
if [ "$1" = "--complete" ]; then
echo "--enabled"
echo "--available"
exit
fi
resolve_link() {
if [ -L "$1" ]; then
$(type -p greadlink readlink | head -1) "$1"
fi
}
samedir() {
local path1="$(resolvepath $1)"
local path2="$(resolvepath $2)"
if [ "$path1" == "$path2" ]; then
return 0;
else
return 1;
fi
}
resolvepath() {
local cwd="$(pwd)"
cd "$1"
echo "$(pwd)"
cd "$cwd"
}
abs_dirname() {
local cwd="$(pwd)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(resolve_link "$name" || true)"
done
pwd
cd "$cwd"
}
if [ "$1" = "--enabled" ] ; then
for plugin in "${JENV_ROOT}"/plugins/*; do
echo $(basename $plugin)
done
else
for plugin in "${JENV_INSTALL_DIR}"/available-plugins/*; do
echo $(basename $plugin)
done
fi