Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: only iterate over directories in the plugins/ directory (#1228)
Fixes part of #1029
  • Loading branch information
Stratus3D committed May 12, 2022
1 parent 37046c7 commit 788ccab
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/commands/command-help.bash
Expand Up @@ -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)"
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/command-list.bash
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/command-plugin-push.bash
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/reshim.bash
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/functions/installs.bash
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/functions/plugins.bash
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion lib/functions/versions.bash
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions test/list_command.bats
Expand Up @@ -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 ]
}

Expand All @@ -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 ]
}

Expand Down

0 comments on commit 788ccab

Please sign in to comment.