From f522ab98797345d767b239041246dfb4b740423e Mon Sep 17 00:00:00 2001 From: Edwin Kofler Date: Tue, 27 Dec 2022 05:33:59 -0800 Subject: [PATCH] fix: Remove usage of `$(pwd)` in favor of `$PWD` --- lib/commands/command-current.bash | 2 +- lib/commands/command-list.bash | 2 +- lib/functions/installs.bash | 4 ++-- lib/functions/versions.bash | 2 +- lib/utils.bash | 6 +++--- test/asdf_elvish.bats | 2 +- test/asdf_fish.bats | 2 +- test/asdf_sh.bats | 2 +- test/utils.bats | 8 ++++---- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/commands/command-current.bash b/lib/commands/command-current.bash index 23095444..f4724626 100644 --- a/lib/commands/command-current.bash +++ b/lib/commands/command-current.bash @@ -10,7 +10,7 @@ plugin_current_command() { check_if_plugin_exists "$plugin_name" local search_path - search_path=$(pwd) + search_path=$PWD local version_and_path version_and_path=$(find_versions "$plugin_name" "$search_path") local full_version diff --git a/lib/commands/command-list.bash b/lib/commands/command-list.bash index 74ee8684..6cb4cd4b 100644 --- a/lib/commands/command-list.bash +++ b/lib/commands/command-list.bash @@ -42,7 +42,7 @@ display_installed_versions() { fi if [ -n "${versions}" ]; then - current_version=$(cut -d '|' -f 1 <<<"$(find_versions "$plugin_name" "$(pwd)")") + current_version=$(cut -d '|' -f 1 <<<"$(find_versions "$plugin_name" "$PWD")") for version in $versions; do flag=" " diff --git a/lib/functions/installs.bash b/lib/functions/installs.bash index 904f87ae..9f85c652 100644 --- a/lib/functions/installs.bash +++ b/lib/functions/installs.bash @@ -39,7 +39,7 @@ get_concurrency() { install_one_local_tool() { local plugin_name=$1 local search_path - search_path=$(pwd) + search_path=$PWD local plugin_versions @@ -65,7 +65,7 @@ install_local_tool_versions() { plugins_path=$(get_plugin_path) local search_path - search_path=$(pwd) + search_path=$PWD local some_tools_installed local some_plugin_not_installed diff --git a/lib/functions/versions.bash b/lib/functions/versions.bash index 4dfa233f..c8269985 100644 --- a/lib/functions/versions.bash +++ b/lib/functions/versions.bash @@ -24,7 +24,7 @@ version_command() { elif [ "$cmd" = "local-tree" ]; then file=$(find_tool_versions) else # cmd = local - file="$(pwd)/$file_name" + file="$PWD/$file_name" fi if [ -L "$file" ]; then diff --git a/lib/utils.bash b/lib/utils.bash index 21865104..be8737dd 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -347,7 +347,7 @@ parse_legacy_version_file() { get_preset_version_for() { local plugin_name=$1 local search_path - search_path=$(pwd) + search_path=$PWD local version_and_path version_and_path=$(find_versions "$plugin_name" "$search_path") local version @@ -451,7 +451,7 @@ find_tool_versions() { find_file_upwards() { local name="$1" local search_path - search_path=$(pwd) + search_path=$PWD while [ "$search_path" != "/" ]; do if [ -f "$search_path/$name" ]; then printf "%s\n" "${search_path}/$name" @@ -706,7 +706,7 @@ select_version() { # These are separated by a space. e.g. python 3.7.2 2.7.15 # For each plugin/version pair, we check if it is present in the shim local search_path - search_path=$(pwd) + search_path=$PWD local shim_versions IFS=$'\n' read -rd '' -a shim_versions <<<"$(get_shim_versions "$shim_name")" diff --git a/test/asdf_elvish.bats b/test/asdf_elvish.bats index 1757c1f4..0bf654c9 100644 --- a/test/asdf_elvish.bats +++ b/test/asdf_elvish.bats @@ -101,7 +101,7 @@ cleaned_path() { @test "function calls asdf command" { result=$(elvish -norc -c " - set-env ASDF_DIR $(pwd) + set-env ASDF_DIR $(pwd) # checkstyle-ignore set paths = [$(cleaned_path)] use asdftest _asdf; var asdf~ = \$_asdf:asdf~ asdf info diff --git a/test/asdf_fish.bats b/test/asdf_fish.bats index 0d94517d..ef797220 100644 --- a/test/asdf_fish.bats +++ b/test/asdf_fish.bats @@ -71,7 +71,7 @@ cleaned_path() { @test "function calls asdf command" { result=$(fish -c " set -e asdf - set -x ASDF_DIR $(pwd) + set -x ASDF_DIR $(pwd) # checkstyle-ignore set PATH $(cleaned_path) . asdf.fish diff --git a/test/asdf_sh.bats b/test/asdf_sh.bats index 0c1785fe..753a755a 100644 --- a/test/asdf_sh.bats +++ b/test/asdf_sh.bats @@ -89,7 +89,7 @@ cleaned_path() { @test "function calls asdf command" { result=$( unset -f asdf - ASDF_DIR=$(pwd) + ASDF_DIR=$PWD PATH=$(cleaned_path) source_asdf_sh diff --git a/test/utils.bats b/test/utils.bats index 715bd336..da181b37 100644 --- a/test/utils.bats +++ b/test/utils.bats @@ -351,11 +351,11 @@ teardown() { @test "resolve_symlink converts the symlink path to the real file path" { touch foo - ln -s $(pwd)/foo bar + ln -s $PWD/foo bar run resolve_symlink bar [ "$status" -eq 0 ] - [ "$output" = $(pwd)/foo ] + [ "$output" = $PWD/foo ] rm -f foo bar } @@ -365,7 +365,7 @@ teardown() { run resolve_symlink baz/bar [ "$status" -eq 0 ] - [ "$output" = $(pwd)/baz/../foo ] + [ "$output" = $PWD/baz/../foo ] rm -f foo bar } @@ -375,7 +375,7 @@ teardown() { run resolve_symlink bar [ "$status" -eq 0 ] - [ "$output" = $(pwd)/foo ] + [ "$output" = $PWD/foo ] rm -f foo bar }