fix: allow plugin callbacks to be in any language (#995)

This commit is contained in:
Trevor Brown 2021-07-29 18:44:14 -04:00 committed by GitHub
parent 60d1863275
commit 2ad0f5ea45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 14 additions and 14 deletions

View File

@ -94,18 +94,18 @@ print_plugin_help() {
# Eventually @jthegedus or someone else will format the output from these
# scripts in a certain way.
bash "${plugin_path}"/bin/help.overview
"${plugin_path}"/bin/help.overview
if [ -f "${plugin_path}"/bin/help.deps ]; then
bash "${plugin_path}"/bin/help.deps
"${plugin_path}"/bin/help.deps
fi
if [ -f "${plugin_path}"/bin/help.config ]; then
bash "${plugin_path}"/bin/help.config
"${plugin_path}"/bin/help.config
fi
if [ -f "${plugin_path}"/bin/help.links ]; then
bash "${plugin_path}"/bin/help.links
"${plugin_path}"/bin/help.links
fi
}

View File

@ -169,7 +169,7 @@ install_tool_version() {
export ASDF_DOWNLOAD_PATH=$download_path
mkdir "$download_path"
asdf_run_hook "pre_asdf_download_${plugin_name}" "$full_version"
bash "${plugin_path}"/bin/download
"${plugin_path}"/bin/download
)
fi
@ -188,7 +188,7 @@ install_tool_version() {
export ASDF_CONCURRENCY=$concurrency
mkdir "$install_path"
asdf_run_hook "pre_asdf_install_${plugin_name}" "$full_version"
bash "${plugin_path}"/bin/install
"${plugin_path}"/bin/install
)
fi

View File

@ -15,7 +15,7 @@ latest_command() {
local versions
if [ -f "${plugin_path}/bin/latest-stable" ]; then
versions=$(bash "${plugin_path}"/bin/latest-stable "$query")
versions=$("${plugin_path}"/bin/latest-stable "$query")
if [ -z "${versions}" ]; then
# this branch requires this print to mimic the error from the list-all branch
printf "No compatible versions available (%s %s)\n" "$plugin_name" "$query" >&2

View File

@ -13,7 +13,7 @@ list_all_command() {
# Capture return code to allow error handling
std_out_file="$(mktemp "/tmp/asdf-command-list-all-${plugin_name}.stdout.XXXXXX")"
std_err_file="$(mktemp "/tmp/asdf-command-list-all-${plugin_name}.stderr.XXXXXX")"
return_code=0 && bash "${plugin_path}/bin/list-all" >"$std_out_file" 2>"$std_err_file" || return_code=$?
return_code=0 && "${plugin_path}/bin/list-all" >"$std_out_file" 2>"$std_err_file" || return_code=$?
if [[ $return_code -ne 0 ]]; then
# Printing all output to allow plugin to handle error formatting

View File

@ -41,7 +41,7 @@ plugin_add_command() {
(
export ASDF_PLUGIN_SOURCE_URL=$source_url
export ASDF_PLUGIN_PATH=$plugin_path
bash "${plugin_path}/bin/post-plugin-add"
"${plugin_path}/bin/post-plugin-add"
)
fi

View File

@ -13,7 +13,7 @@ plugin_remove_command() {
if [ -f "${plugin_path}/bin/pre-plugin-remove" ]; then
(
export ASDF_PLUGIN_PATH=$plugin_path
bash "${plugin_path}/bin/pre-plugin-remove"
"${plugin_path}/bin/pre-plugin-remove"
)
fi

View File

@ -36,7 +36,7 @@ uninstall_command() {
export ASDF_INSTALL_TYPE=$install_type
export ASDF_INSTALL_VERSION=$version
export ASDF_INSTALL_PATH=$install_path
bash "${plugin_path}/bin/uninstall"
"${plugin_path}/bin/uninstall"
)
else
rm -rf "$install_path"

View File

@ -198,7 +198,7 @@ find_versions() {
local legacy_filenames=""
if [ "$legacy_config" = "yes" ] && [ -f "$legacy_list_filenames_script" ]; then
legacy_filenames=$(bash "$legacy_list_filenames_script")
legacy_filenames=$($legacy_list_filenames_script)
fi
while [ "$search_path" != "/" ]; do
@ -329,7 +329,7 @@ parse_legacy_version_file() {
if [ -f "$file_path" ]; then
if [ -f "$parse_legacy_script" ]; then
bash "$parse_legacy_script" "$file_path"
"$parse_legacy_script" "$file_path"
else
cat "$file_path"
fi
@ -481,7 +481,7 @@ list_plugin_bin_paths() {
export ASDF_INSTALL_TYPE=$install_type
export ASDF_INSTALL_VERSION=$version
export ASDF_INSTALL_PATH=$install_path
bash "${plugin_path}/bin/list-bin-paths"
"${plugin_path}/bin/list-bin-paths"
)
else
local space_separated_list_of_bin_paths="bin"

0
test/fixtures/dummy_broken_plugin/bin/install vendored Normal file → Executable file
View File

0
test/fixtures/dummy_broken_plugin/bin/list-all vendored Normal file → Executable file
View File

0
test/fixtures/dummy_legacy_plugin/bin/install vendored Normal file → Executable file
View File

0
test/fixtures/dummy_legacy_plugin/bin/list-all vendored Normal file → Executable file
View File

0
test/fixtures/dummy_legacy_plugin/bin/list-legacy-filenames vendored Normal file → Executable file
View File

0
test/fixtures/dummy_legacy_plugin/bin/parse-legacy-file vendored Normal file → Executable file
View File

0
test/fixtures/dummy_plugin/bin/help.overview vendored Normal file → Executable file
View File

0
test/fixtures/dummy_plugin/bin/install vendored Normal file → Executable file
View File

0
test/fixtures/dummy_plugin/bin/list-all vendored Normal file → Executable file
View File

0
test/fixtures/dummy_plugin/bin/list-legacy-filenames vendored Normal file → Executable file
View File

0
test/fixtures/dummy_plugin/bin/parse-legacy-file vendored Normal file → Executable file
View File

0
test/fixtures/dummy_plugin/bin/post-plugin-add vendored Normal file → Executable file
View File

0
test/fixtures/dummy_plugin/bin/pre-plugin-remove vendored Normal file → Executable file
View File