mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 09:38:16 -07:00
ec6662d4c0
Previous implementation exits abruptly when no version is installed for a plugin. This prevented the list command from listing the versions for some other plugins. This commit allows list command to continue executing even when no version is installed for some plugins. Example, plugin a with 1.0, b with none, and c with 2.0. Previous implementation: ``` $ asdf list a 1.0 b No versions installed ``` After commit changes: ``` $ asdf list a 1.0 b No versions installed c 2.0 ```
35 lines
787 B
Bash
35 lines
787 B
Bash
list_command() {
|
|
local plugin_name=$1
|
|
|
|
if [ -z "$plugin_name" ]; then
|
|
local plugins_path
|
|
plugins_path=$(get_plugin_path)
|
|
|
|
if ls "$plugins_path" &> /dev/null; then
|
|
for plugin_path in "$plugins_path"/* ; do
|
|
plugin_name=$(basename "$plugin_path")
|
|
echo "$plugin_name"
|
|
display_installed_versions "$plugin_name"
|
|
done
|
|
else
|
|
printf "%s\\n" 'Oohes nooes ~! No plugins installed'
|
|
fi
|
|
else
|
|
check_if_plugin_exists "$plugin_name"
|
|
display_installed_versions "$plugin_name"
|
|
fi
|
|
}
|
|
|
|
display_installed_versions() {
|
|
local versions
|
|
versions=$(list_installed_versions "$1")
|
|
|
|
if [ -n "${versions}" ]; then
|
|
for version in $versions; do
|
|
echo " $version"
|
|
done
|
|
else
|
|
display_error 'No versions installed'
|
|
fi
|
|
}
|