2019-11-27 01:24:29 -07:00
|
|
|
# -*- sh -*-
|
|
|
|
|
2015-05-28 11:38:13 -07:00
|
|
|
where_command() {
|
|
|
|
local plugin_name=$1
|
|
|
|
local full_version=$2
|
2017-09-04 10:04:56 -07:00
|
|
|
check_if_plugin_exists "$plugin_name"
|
2015-05-28 11:38:13 -07:00
|
|
|
|
2018-10-28 10:47:21 -07:00
|
|
|
local version
|
|
|
|
local install_type="version"
|
|
|
|
if [[ -z ${full_version} ]]; then
|
|
|
|
local version_and_path
|
2019-10-22 16:03:05 -07:00
|
|
|
version_and_path=$(find_versions "$plugin_name" "$PWD")
|
2019-11-29 09:15:38 -07:00
|
|
|
version=$(cut -d '|' -f 1 <<<"$version_and_path")
|
2015-05-28 11:38:13 -07:00
|
|
|
else
|
2018-10-28 10:47:21 -07:00
|
|
|
local -a version_info
|
2019-11-29 09:15:38 -07:00
|
|
|
IFS=':' read -r -a version_info <<<"$full_version"
|
2018-10-28 10:47:21 -07:00
|
|
|
if [ "${version_info[0]}" = "ref" ]; then
|
|
|
|
install_type="${version_info[0]}"
|
|
|
|
version="${version_info[1]}"
|
|
|
|
else
|
|
|
|
version="${version_info[0]}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$version" ]; then
|
|
|
|
display_no_version_set "$plugin_name"
|
|
|
|
exit 1
|
2015-05-28 11:38:13 -07:00
|
|
|
fi
|
|
|
|
|
2017-09-04 10:04:56 -07:00
|
|
|
local install_path
|
|
|
|
install_path=$(get_install_path "$plugin_name" "$install_type" "$version")
|
2015-05-28 11:38:13 -07:00
|
|
|
|
2017-09-04 10:04:56 -07:00
|
|
|
if [ -d "$install_path" ]; then
|
|
|
|
echo "$install_path"
|
2015-05-28 11:38:13 -07:00
|
|
|
exit 0
|
|
|
|
else
|
2019-03-23 07:45:50 -07:00
|
|
|
if [ "$version" = "system" ]; then
|
|
|
|
echo "System version is selected"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Version not installed"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-05-28 11:38:13 -07:00
|
|
|
fi
|
|
|
|
}
|
2019-11-27 01:24:29 -07:00
|
|
|
|
|
|
|
where_command "$@"
|