@@ -22,7 +22,10 @@ asdf_dir() {
22
22
if [ -z " $ASDF_DIR " ]; then
23
23
local current_script_path=${BASH_SOURCE[0]}
24
24
export ASDF_DIR
25
- ASDF_DIR=$( cd " $( dirname " $( dirname " $current_script_path " ) " ) " || exit ; pwd)
25
+ ASDF_DIR=$(
26
+ cd " $( dirname " $( dirname " $current_script_path " ) " ) " || exit
27
+ pwd
28
+ )
26
29
fi
27
30
28
31
echo " $ASDF_DIR "
@@ -32,9 +35,9 @@ asdf_repository_url() {
32
35
echo " https://github.com/asdf-vm/asdf-plugins.git"
33
36
}
34
37
35
- asdf_data_dir (){
38
+ asdf_data_dir () {
36
39
local data_dir
37
-
40
+
38
41
if [ -n " ${ASDF_DATA_DIR} " ]; then
39
42
data_dir=" ${ASDF_DATA_DIR} "
40
43
elif [[ $EUID -ne 0 ]]; then
@@ -56,8 +59,7 @@ get_install_path() {
56
59
57
60
mkdir -p " ${install_dir} /${plugin} "
58
61
59
- if [ " $install_type " = " version" ]
60
- then
62
+ if [ " $install_type " = " version" ]; then
61
63
echo " ${install_dir} /${plugin} /${version} "
62
64
else
63
65
echo " ${install_dir} /${plugin} /${install_type} -${version} "
@@ -149,12 +151,12 @@ find_versions() {
149
151
local version
150
152
version=$( get_version_from_env " $plugin_name " )
151
153
if [ -n " $version " ]; then
152
- local upcase_name
153
- upcase_name=$( echo " $plugin_name " | tr ' [:lower:]-' ' [:upper:]_' )
154
- local version_env_var=" ASDF_${upcase_name} _VERSION"
154
+ local upcase_name
155
+ upcase_name=$( echo " $plugin_name " | tr ' [:lower:]-' ' [:upper:]_' )
156
+ local version_env_var=" ASDF_${upcase_name} _VERSION"
155
157
156
- echo " $version |$version_env_var environment variable"
157
- return 0
158
+ echo " $version |$version_env_var environment variable"
159
+ return 0
158
160
fi
159
161
160
162
local plugin_path
@@ -194,7 +196,7 @@ display_no_version_set() {
194
196
echo " No version set for ${plugin_name} ; please run \` asdf <global | local> ${plugin_name} <version>\` "
195
197
}
196
198
197
- get_version_from_env () {
199
+ get_version_from_env () {
198
200
local plugin_name=$1
199
201
local upcase_name
200
202
upcase_name=$( echo " $plugin_name " | tr ' [:lower:]-' ' [:upper:]_' )
@@ -208,7 +210,7 @@ find_install_path() {
208
210
local version=$2
209
211
210
212
# shellcheck disable=SC2162
211
- IFS=' :' read -a version_info <<< " $version"
213
+ IFS=' :' read -a version_info <<< " $version"
212
214
213
215
if [ " $version " = " system" ]; then
214
216
echo " "
@@ -278,7 +280,7 @@ parse_asdf_version_file() {
278
280
279
281
if [ -f " $file_path " ]; then
280
282
local version
281
- version=$( strip_tool_version_comments " $file_path " | grep " ^${plugin_name} " | sed -e " s/^${plugin_name} //" )
283
+ version=$( strip_tool_version_comments " $file_path " | grep " ^${plugin_name} " | sed -e " s/^${plugin_name} //" )
282
284
if [ -n " $version " ]; then
283
285
echo " $version "
284
286
return 0
@@ -311,7 +313,7 @@ get_preset_version_for() {
311
313
local version_and_path
312
314
version_and_path=$( find_versions " $plugin_name " " $search_path " )
313
315
local version
314
- version=$( cut -d ' |' -f 1 <<< " $version_and_path" ) ;
316
+ version=$( cut -d ' |' -f 1 <<< " $version_and_path" )
315
317
316
318
echo " $version "
317
319
}
@@ -383,7 +385,6 @@ get_plugin_source_url() {
383
385
384
386
plugin_config=" $( asdf_data_dir) /repository/plugins/$plugin_name "
385
387
386
-
387
388
if [ -f " $plugin_config " ]; then
388
389
grep " repository" " $plugin_config " | awk -F' =' ' {print $2}' | sed ' s/ //'
389
390
fi
@@ -399,8 +400,8 @@ find_file_upwards() {
399
400
search_path=$( pwd)
400
401
while [ " $search_path " != " /" ]; do
401
402
if [ -f " $search_path /$name " ]; then
402
- echo " ${search_path} /$name "
403
- return 0
403
+ echo " ${search_path} /$name "
404
+ return 0
404
405
fi
405
406
search_path=$( dirname " $search_path " )
406
407
done
@@ -446,7 +447,7 @@ list_plugin_bin_paths() {
446
447
export ASDF_INSTALL_VERSION=$version
447
448
export ASDF_INSTALL_PATH=$install_path
448
449
bash " ${plugin_path} /bin/list-bin-paths"
449
- )
450
+ )
450
451
else
451
452
local space_separated_list_of_bin_paths=" bin"
452
453
fi
@@ -458,7 +459,7 @@ list_plugin_exec_paths() {
458
459
local full_version=$2
459
460
check_if_plugin_exists " $plugin_name "
460
461
461
- IFS=' :' read -r -a version_info <<< " $full_version"
462
+ IFS=' :' read -r -a version_info <<< " $full_version"
462
463
if [ " ${version_info[0]} " = " ref" ]; then
463
464
local install_type=" ${version_info[0]} "
464
465
local version=" ${version_info[1]} "
@@ -474,7 +475,7 @@ list_plugin_exec_paths() {
474
475
fi
475
476
476
477
space_separated_list_of_bin_paths=" $( list_plugin_bin_paths " $plugin_name " " $version " " $install_type " ) "
477
- IFS=' ' read -r -a all_bin_paths <<< " $space_separated_list_of_bin_paths"
478
+ IFS=' ' read -r -a all_bin_paths <<< " $space_separated_list_of_bin_paths"
478
479
479
480
local install_path
480
481
install_path=$( get_install_path " $plugin_name " " $install_type " " $version " )
@@ -489,7 +490,7 @@ with_plugin_env() {
489
490
local full_version=$2
490
491
local callback=$3
491
492
492
- IFS=' :' read -r -a version_info <<< " $full_version"
493
+ IFS=' :' read -r -a version_info <<< " $full_version"
493
494
if [ " ${version_info[0]} " = " ref" ]; then
494
495
local install_type=" ${version_info[0]} "
495
496
local version=" ${version_info[1]} "
@@ -546,7 +547,6 @@ plugin_executables() {
546
547
done
547
548
}
548
549
549
-
550
550
is_executable () {
551
551
local executable_path=$1
552
552
if [[ (-f " $executable_path " ) && (-x " $executable_path " ) ]]; then
@@ -585,7 +585,7 @@ strip_tool_version_comments() {
585
585
if [[ -n " $new_line " ]]; then
586
586
echo " $new_line "
587
587
fi
588
- done < " $tool_version_path "
588
+ done < " $tool_version_path "
589
589
}
590
590
591
591
asdf_run_hook () {
@@ -625,15 +625,15 @@ with_shim_executable() {
625
625
local search_path
626
626
search_path=$( pwd)
627
627
local shim_versions
628
- IFS=$' \n ' read -rd ' ' -a shim_versions <<< " $(get_shim_versions)"
628
+ IFS=$' \n ' read -rd ' ' -a shim_versions <<< " $(get_shim_versions)"
629
629
630
630
local plugins
631
631
plugins=()
632
632
633
633
for plugin_and_version in " ${shim_versions[@]} " ; do
634
634
local plugin_name
635
635
local plugin_shim_version
636
- IFS=' ' read -r plugin_name _plugin_shim_version <<< " $plugin_and_version"
636
+ IFS=' ' read -r plugin_name _plugin_shim_version <<< " $plugin_and_version"
637
637
if ! [[ " ${plugins[*]} " == * " $plugin_name " * ]]; then
638
638
plugins+=(" $plugin_name " )
639
639
fi
@@ -645,15 +645,15 @@ with_shim_executable() {
645
645
local usable_plugin_versions
646
646
local _path
647
647
version_and_path=$( find_versions " $plugin_name " " $search_path " )
648
- IFS=' |' read -r version_string _path <<< " $version_and_path"
649
- IFS=' ' read -r -a usable_plugin_versions <<< " $version_string"
648
+ IFS=' |' read -r version_string _path <<< " $version_and_path"
649
+ IFS=' ' read -r -a usable_plugin_versions <<< " $version_string"
650
650
for plugin_version in " ${usable_plugin_versions[@]} " ; do
651
651
for plugin_and_version in " ${shim_versions[@]} " ; do
652
652
local plugin_shim_name
653
653
local plugin_shim_version
654
- IFS=' ' read -r plugin_shim_name plugin_shim_version <<< " $plugin_and_version"
655
- if [[ " $plugin_name " = " $plugin_shim_name " ]] &&
656
- [[ " $plugin_version " = " $plugin_shim_version " ]]; then
654
+ IFS=' ' read -r plugin_shim_name plugin_shim_version <<< " $plugin_and_version"
655
+ if [[ " $plugin_name " == " $plugin_shim_name " ]] &&
656
+ [[ " $plugin_version " = = " $plugin_shim_version " ]]; then
657
657
echo " $plugin_name $plugin_version "
658
658
return
659
659
fi
@@ -683,7 +683,7 @@ with_shim_executable() {
683
683
local full_version
684
684
local plugin_path
685
685
686
- IFS=' ' read -r plugin_name full_version <<< " $selected_version"
686
+ IFS=' ' read -r plugin_name full_version <<< " $selected_version"
687
687
plugin_path=$( get_plugin_path " $plugin_name " )
688
688
689
689
run_within_env () {
0 commit comments