fix: only iterate over directories in the plugins/ directory (#1228)

Fixes part of #1029
This commit is contained in:
Trevor Brown 2022-05-12 07:48:54 -04:00 committed by GitHub
parent 37046c7c64
commit 788ccab597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 11 deletions

View File

@ -18,7 +18,7 @@ EOF
asdf_extension_cmds() {
local plugins_path plugin_path ext_cmd_path ext_cmds plugin
plugins_path="$(get_plugin_path)"
for plugin_path in "$plugins_path"/*; do
for plugin_path in "$plugins_path"/*/; do
plugin="$(basename "$plugin_path")"
ext_cmd_path="$plugin_path/lib/commands"
ext_cmds="$(find "$ext_cmd_path" -name "command*.bash" 2>/dev/null)"

View File

@ -9,7 +9,7 @@ list_command() {
plugins_path=$(get_plugin_path)
if find "$plugins_path" -mindepth 1 -type d &>/dev/null; then
for plugin_path in "$plugins_path"/*; do
for plugin_path in "$plugins_path"/*/; do
plugin_name=$(basename "$plugin_path")
printf "%s\\n" "$plugin_name"
display_installed_versions "$plugin_name" "$query"

View File

@ -3,7 +3,7 @@
plugin_push_command() {
local plugin_name=$1
if [ "$plugin_name" = "--all" ]; then
for dir in "$(asdf_data_dir)"/plugins/*; do
for dir in "$(asdf_data_dir)"/plugins/*/; do
printf "Pushing %s...\\n" "$(basename "$dir")"
(cd "$dir" && git push)
done

View File

@ -33,7 +33,7 @@ reshim_command() {
plugins_path=$(get_plugin_path)
if find "$plugins_path" -mindepth 1 -type d &>/dev/null; then
for plugin_path in "$plugins_path"/*; do
for plugin_path in "$plugins_path"/*/; do
plugin_name=$(basename "$plugin_path")
reshim_command "$plugin_name"
done

View File

@ -77,7 +77,7 @@ install_local_tool_versions() {
# Locate all the plugins installed in the system
local plugins_installed
if find "$plugins_path" -mindepth 1 -type d &>/dev/null; then
for plugin_path in "$plugins_path"/*; do
for plugin_path in "$plugins_path"/*/; do
local plugin_name
plugin_name=$(basename "$plugin_path")
plugins_installed="$plugins_installed $plugin_name"

View File

@ -23,7 +23,7 @@ plugin_list_command() {
if find "$plugins_path" -mindepth 1 -type d &>/dev/null; then
(
for plugin_path in "$plugins_path"/*; do
for plugin_path in "$plugins_path"/*/; do
plugin_name=$(basename "$plugin_path")
printf "%s" "$plugin_name"

View File

@ -158,7 +158,7 @@ latest_all() {
plugins_path=$(get_plugin_path)
if find "$plugins_path" -mindepth 1 -type d &>/dev/null; then
for plugin_path in "$plugins_path"/*; do
for plugin_path in "$plugins_path"/*/; do
plugin_name=$(basename "$plugin_path")
# Retrieve the version of the plugin

View File

@ -16,8 +16,8 @@ teardown() {
run asdf install dummy 1.0.0
run asdf install dummy 1.1.0
run asdf list
[[ "$output" == "$(echo -e "dummy\n 1.0.0\n 1.1.0")"* ]]
[[ "$output" == *"$(echo -e "dummy-broken\n No versions installed")" ]]
[[ "$output" == *"$(echo -e "dummy\n 1.0.0\n 1.1.0")"* ]]
[[ "$output" == *"$(echo -e "dummy-broken\n No versions installed")"* ]]
[ "$status" -eq 0 ]
}
@ -28,10 +28,10 @@ teardown() {
run asdf install dummy 1.0.0
run asdf install tummy 2.0.0
run asdf list
[[ "$output" == "$(echo -e "dummy\n 1.0.0")"* ]]
[[ "$output" == *"$(echo -e "dummy\n 1.0.0")"* ]]
[[ "$output" == *"$(echo -e "dummy-broken\n No versions installed")"* ]]
[[ "$output" == *"$(echo -e "mummy\n No versions installed")"* ]]
[[ "$output" == *"$(echo -e "tummy\n 2.0.0")" ]]
[[ "$output" == *"$(echo -e "tummy\n 2.0.0")"* ]]
[ "$status" -eq 0 ]
}