File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,9 +25,9 @@ install_command() {
2525}
2626
2727get_concurrency () {
28- if which nproc > /dev/null 2>&1 ; then
28+ if command -v nproc > /dev/null 2>&1 ; then
2929 nproc
30- elif which sysctl > /dev/null 2>&1 && sysctl hw.ncpu > /dev/null 2>&1 ; then
30+ elif command -v sysctl > /dev/null 2>&1 && sysctl hw.ncpu > /dev/null 2>&1 ; then
3131 sysctl -n hw.ncpu
3232 elif [ -f /proc/cpuinfo ]; then
3333 grep -c processor /proc/cpuinfo
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ list_command() {
66 plugins_path=$( get_plugin_path)
77
88 if ls " $plugins_path " & > /dev/null; then
9- for plugin_path in $plugins_path /* ; do
9+ for plugin_path in " $plugins_path " /* ; do
1010 plugin_name=$( basename " $plugin_path " )
1111 echo " $plugin_name "
1212 display_installed_versions " $plugin_name "
@@ -32,4 +32,4 @@ display_installed_versions() {
3232 display_error ' No versions installed'
3333 exit 1
3434 fi
35- }
35+ }
Original file line number Diff line number Diff line change @@ -8,12 +8,12 @@ plugin_list_all_command() {
88 plugins_local_path=" $( get_plugin_path) "
99
1010 if ls " $plugins_index_path " & > /dev/null; then
11- for index_plugin in $plugins_index_path /* ; do
11+ for index_plugin in " $plugins_index_path " /* ; do
1212 index_plugin_name=$( basename " $index_plugin " )
1313 source_url=$( get_plugin_source_url " $index_plugin_name " )
1414 installed_flag=" "
1515
16- for local_plugin in $plugins_local_path /* ; do
16+ for local_plugin in " $plugins_local_path " /* ; do
1717 local_plugin_name=$( basename " $local_plugin " )
1818 [[ " $index_plugin_name " == " $local_plugin_name " ]] && installed_flag=" *"
1919 done
Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ plugin_list_command() {
22 local flag=$1
33
44 # 0 || 1 with flag
5- if [ $# -eq 0 ] || ( [ $# -eq 1 ] && [ " $flag " == " --urls" ]) ; then
5+ if [ $# -eq 0 ] || { [ $# -eq 1 ] && [ " $flag " = " --urls" ]; } ; then
66 # valid command
77
88 local plugins_path
99 plugins_path=$( get_plugin_path)
1010
1111 if ls " $plugins_path " & > /dev/null; then
12- for plugin_path in $plugins_path /* ; do
12+ for plugin_path in " $plugins_path " /* ; do
1313 plugin_name=$( basename " $plugin_path " )
1414
1515 if [ $# -eq 0 ]; then
Original file line number Diff line number Diff line change 11plugin_push_command () {
22 local plugin_name=$1
33 if [ " $plugin_name " = " --all" ]; then
4- for dir in $( asdf_dir) /plugins/* ; do
4+ for dir in " $( asdf_dir) " /plugins/* ; do
55 echo " Pushing $( basename " $dir " ) ..."
66 (cd " $dir " && git push)
77 done
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ generate_shims_for_version() {
139139 install_path=$( get_install_path " $plugin_name " " $install_type " " $version " )
140140
141141 for bin_path in " ${all_bin_paths[@]} " ; do
142- for executable_file in $install_path /$bin_path /* ; do
142+ for executable_file in " $install_path /$bin_path " /* ; do
143143 # because just $executable_file gives absolute path; We don't want version hardcoded in shim
144144 local executable_path_relative_to_install_path
145145 executable_path_relative_to_install_path=" $bin_path " /$( basename " $executable_file " )
@@ -238,7 +238,7 @@ remove_shims_for_version() {
238238 IFS=' ' read -r -a all_bin_paths <<< " $space_separated_list_of_bin_paths"
239239
240240 for bin_path in " ${all_bin_paths[@]} " ; do
241- for executable_file in $install_path /$bin_path /* ; do
241+ for executable_file in " $install_path /$bin_path " /* ; do
242242 local executable_name
243243 executable_name=" $( basename " $executable_file " ) "
244244 remove_shim_for_version " $plugin_name " " $executable_name " " $version "
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ get_executable_path() {
214214 if [ " $version " = " system" ]; then
215215 path=$( echo " $PATH " | sed -e " s|$ASDF_DIR /shims||g; s|::|:|g" )
216216 cmd=$( basename " $executable_path " )
217- cmd_path=$( PATH=$path which " $cmd " 2>&1 )
217+ cmd_path=$( PATH=$path command -v " $cmd " 2>&1 )
218218 # shellcheck disable=SC2181
219219 if [ $? -ne 0 ]; then
220220 return 1
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33# shellcheck source=lib/utils.sh
4- . $( dirname $BATS_TEST_DIRNAME ) /lib/utils.sh
4+ . " $( dirname " $BATS_TEST_DIRNAME " ) " /lib/utils.sh
55
66setup_asdf_dir () {
77 BASE_DIR=$( mktemp -dt asdf.XXXX)
Original file line number Diff line number Diff line change 22
33load test_helpers
44
5- . $( dirname $BATS_TEST_DIRNAME ) /lib/commands/update.sh
6- . $( dirname $BATS_TEST_DIRNAME ) /lib/commands/reshim.sh
7- . $( dirname $BATS_TEST_DIRNAME ) /lib/commands/install.sh
8- . $( dirname $BATS_TEST_DIRNAME ) /lib/commands/uninstall.sh
5+ . $( dirname " $BATS_TEST_DIRNAME " ) /lib/commands/update.sh
6+ . $( dirname " $BATS_TEST_DIRNAME " ) /lib/commands/reshim.sh
7+ . $( dirname " $BATS_TEST_DIRNAME " ) /lib/commands/install.sh
8+ . $( dirname " $BATS_TEST_DIRNAME " ) /lib/commands/uninstall.sh
99
1010setup () {
1111 setup_asdf_dir
You can’t perform that action at this time.
0 commit comments