3
. "$(dirname "$(dirname "$0")")/lib/functions/plugins.bash"
5
# shellcheck disable=SC2059
6
plugin_current_command() {
8
local terminal_format=$2
10
check_if_plugin_exists "$plugin_name"
14
local version_and_path
15
version_and_path=$(find_versions "$plugin_name" "$search_path")
17
full_version=$(cut -d '|' -f 1 <<<"$version_and_path")
18
local version_file_path
19
version_file_path=$(cut -d '|' -f 2 <<<"$version_and_path")
20
local version_not_installed
23
IFS=' ' read -r -a versions <<<"$full_version"
24
for version in "${versions[@]}"; do
25
if ! (check_if_version_exists "$plugin_name" "$version"); then
26
version_not_installed="$version"
29
check_for_deprecated_plugin "$plugin_name"
31
if [ -n "$version_not_installed" ]; then
32
description="Not installed. Run \"asdf install $plugin $version\""
33
printf "$terminal_format" "$plugin" "$version" "$description" 1>&2
35
elif [ -z "$full_version" ]; then
36
description="No version is set. Run \"asdf <global|shell|local> $plugin <version>\""
37
printf "$terminal_format" "$plugin" "______" "$description" 1>&2
40
description="$version_file_path"
41
printf "$terminal_format" "$plugin" "$full_version" "$description"
47
local terminal_format="%-15s %-15s %-10s\n"
54
for plugin in $(plugin_list_command); do
55
plugin_current_command "$plugin" "$terminal_format"
59
plugin_current_command "$plugin" "$terminal_format"
67
check_for_deprecated_plugin() {
71
plugin_path=$(get_plugin_path "$plugin_name")
73
legacy_config=$(get_asdf_config_value "legacy_version_file")
74
local deprecated_script="${plugin_path}/bin/get-version-from-legacy-file"
75
local new_script="${plugin_path}/bin/list-legacy-filenames"
77
if [ "$legacy_config" = "yes" ] && [ -f "$deprecated_script" ] && [ ! -f "$new_script" ]; then
78
printf "Heads up! It looks like your %s plugin is out of date. You can update it with:\n\n" "$plugin_name"
79
printf " asdf plugin-update %s\n\n" "$plugin_name"