Skip to content

Commit b8dc5f1

Browse files
committedNov 29, 2019
Run shfmt on bash files
1 parent ab63d72 commit b8dc5f1

28 files changed

+295
-306
lines changed
 

‎.github/workflows/workflow.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ jobs:
7373
run: brew install shfmt
7474

7575
- name: Run shfmt
76-
run: shfmt -d -i 2 -ci .
76+
run: shfmt -d -i 2 -ci . lib/commands/*

‎bin/asdf

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ find_cmd() {
1111
local args_offset="$#"
1212
cmd_name="command-$(echo "${@:1:${args_offset}}" | tr ' ' '-')"
1313
while [ ! -f "$cmd_dir/$cmd_name" ] && [ "$args_offset" -gt 0 ]; do
14-
args_offset=$((args_offset-1))
14+
args_offset=$((args_offset - 1))
1515
cmd_name="command-$(echo "${@:1:${args_offset}}" | tr ' ' '-')"
1616
done
1717

1818
if [ -f "$cmd_dir/$cmd_name" ]; then
19-
echo "$cmd_dir/$cmd_name" "$((args_offset+1))"
19+
echo "$cmd_dir/$cmd_name" "$((args_offset + 1))"
2020
elif [ -f "$cmd_dir/command" ]; then
2121
echo "$cmd_dir/command" 1
2222
fi
@@ -26,21 +26,21 @@ find_asdf_cmd() {
2626
local asdf_cmd_dir
2727
asdf_cmd_dir="$(asdf_dir)/lib/commands"
2828
case "$1" in
29-
('exec' | 'current' | 'env' | 'global' | 'install' | 'latest' | 'local' |\
30-
'reshim' | 'uninstall' | 'update' | 'where' | 'which' |\
31-
'export-shell-version')
29+
'exec' | 'current' | 'env' | 'global' | 'install' | 'latest' | 'local' | \
30+
'reshim' | 'uninstall' | 'update' | 'where' | 'which' | \
31+
'export-shell-version')
3232
echo "$asdf_cmd_dir/command-$1" 2
3333
;;
3434

35-
('' | '--help' | '-h' | 'help')
35+
'' | '--help' | '-h' | 'help')
3636
echo "$asdf_cmd_dir/command-help" 2
3737
;;
3838

39-
('--version' | 'version')
39+
'--version' | 'version')
4040
echo "$asdf_cmd_dir/command-version" 2
4141
;;
4242

43-
(*)
43+
*)
4444
find_cmd "$asdf_cmd_dir" "$@"
4545
;;
4646
esac
@@ -51,7 +51,7 @@ find_plugin_cmd() {
5151
if [ -d "$(get_plugin_path "$1")/bin" ]; then
5252
IFS=' ' read -r ASDF_CMD_FILE args_offset <<<"$(find_cmd "$(get_plugin_path "$1")/bin" "${@:2}")"
5353
if [ -n "$ASDF_CMD_FILE" ]; then
54-
args_offset=$((args_offset+1)) # since the first argument is the plugin name
54+
args_offset=$((args_offset + 1)) # since the first argument is the plugin name
5555
echo "$ASDF_CMD_FILE" "$args_offset"
5656
fi
5757
fi
@@ -62,7 +62,7 @@ asdf_cmd() {
6262

6363
if [ "shell" == "$1" ]; then
6464
echo "Shell integration is not enabled. Please ensure you source asdf in your shell setup." >&2
65-
exit 1;
65+
exit 1
6666
fi
6767

6868
IFS=' ' read -r ASDF_CMD_FILE args_offset <<<"$(find_asdf_cmd "$@")"

‎bin/private/asdf-exec

-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ shim_name=$(basename "$2")
1313
echo "asdf: now running $shim_name"
1414

1515
exec "$shim_name" "${@:3}"
16-

‎completions/asdf.bash

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env bash
22

3-
_asdf () {
3+
_asdf() {
44
local cur
55
cur=${COMP_WORDS[COMP_CWORD]}
66
local cmd
77
cmd=${COMP_WORDS[1]}
88
local prev
9-
prev=${COMP_WORDS[COMP_CWORD-1]}
9+
prev=${COMP_WORDS[COMP_CWORD - 1]}
1010
local plugins
11-
plugins=$(asdf plugin-list 2> /dev/null | tr '\n' ' ')
11+
plugins=$(asdf plugin-list 2>/dev/null | tr '\n' ' ')
1212

1313
# We can safely ignore warning SC2207 since it warns that it will uses the
1414
# shell's sloppy word splitting and globbing. The possible commands here are
@@ -21,20 +21,20 @@ _asdf () {
2121
# shellcheck disable=SC2207
2222
COMPREPLY=($(compgen -W "$plugins --all" -- "$cur"))
2323
;;
24-
plugin-remove|current|list|list-all)
24+
plugin-remove | current | list | list-all)
2525
# shellcheck disable=SC2207
2626
COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
2727
;;
2828
plugin-add)
2929
local available_plugins
30-
available_plugins=$( (asdf plugin-list 2> /dev/null && asdf plugin-list-all 2> /dev/null) | sort | uniq -u)
30+
available_plugins=$( (asdf plugin-list 2>/dev/null && asdf plugin-list-all 2>/dev/null) | sort | uniq -u)
3131
# shellcheck disable=SC2207
3232
COMPREPLY=($(compgen -W "$available_plugins" -- "$cur"))
3333
;;
3434
install)
35-
if [[ "$plugins" == *"$prev"* ]] ; then
35+
if [[ "$plugins" == *"$prev"* ]]; then
3636
local versions
37-
versions=$(asdf list-all "$prev" 2> /dev/null)
37+
versions=$(asdf list-all "$prev" 2>/dev/null)
3838
# shellcheck disable=SC2207
3939
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
4040
else
@@ -46,10 +46,10 @@ _asdf () {
4646
# shellcheck disable=SC2207
4747
COMPREPLY=($(compgen -W "--head" -- "$cur"))
4848
;;
49-
uninstall|where|reshim|local|global|shell)
50-
if [[ "$plugins" == *"$prev"* ]] ; then
49+
uninstall | where | reshim | local | global | shell)
50+
if [[ "$plugins" == *"$prev"* ]]; then
5151
local versions
52-
versions=$(asdf list "$prev" 2> /dev/null)
52+
versions=$(asdf list "$prev" 2>/dev/null)
5353
# shellcheck disable=SC2207
5454
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
5555
else

‎lib/asdf.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ asdf() {
99
case "$command" in
1010
"shell")
1111
# commands that need to export variables
12-
command e"val" "$(asdf export-shell-version sh "$@")";;
12+
command e"val" "$(asdf export-shell-version sh "$@")"
13+
;;
1314
*)
1415
# forward other commands to asdf script
15-
command asdf "$command" "$@";;
16+
command asdf "$command" "$@"
17+
;;
1618

1719
esac
1820
}

‎lib/commands/command-current

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ plugin_current_command() {
1010
local version_and_path
1111
version_and_path=$(find_versions "$plugin_name" "$search_path")
1212
local full_version
13-
full_version=$(cut -d '|' -f 1 <<< "$version_and_path");
13+
full_version=$(cut -d '|' -f 1 <<<"$version_and_path")
1414
local version_file_path
15-
version_file_path=$(cut -d '|' -f 2 <<< "$version_and_path");
15+
version_file_path=$(cut -d '|' -f 2 <<<"$version_and_path")
1616

17-
IFS=' ' read -r -a versions <<< "$full_version"
17+
IFS=' ' read -r -a versions <<<"$full_version"
1818
for version in "${versions[@]}"; do
1919
check_if_version_exists "$plugin_name" "$version"
2020
done

‎lib/commands/command-export-shell-version

+6-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ shell_command() {
2828
fi
2929

3030
case "$asdf_shell" in
31-
fish )
32-
echo "set -gx $version_env_var \"$version\"";;
33-
* )
34-
echo "export $version_env_var=\"$version\"";;
31+
fish)
32+
echo "set -gx $version_env_var \"$version\""
33+
;;
34+
*)
35+
echo "export $version_env_var=\"$version\""
36+
;;
3537
esac
3638
}
3739

‎lib/commands/command-install

+6-8
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ install_command() {
2727
}
2828

2929
get_concurrency() {
30-
if command -v nproc > /dev/null 2>&1; then
30+
if command -v nproc >/dev/null 2>&1; then
3131
nproc
32-
elif command -v sysctl > /dev/null 2>&1 && sysctl hw.ncpu > /dev/null 2>&1; then
32+
elif command -v sysctl >/dev/null 2>&1 && sysctl hw.ncpu >/dev/null 2>&1; then
3333
sysctl -n hw.ncpu
3434
elif [ -f /proc/cpuinfo ]; then
3535
grep -c processor /proc/cpuinfo
@@ -47,8 +47,8 @@ install_local_tool_versions() {
4747

4848
local some_tools_installed
4949

50-
if ls "$plugins_path" &> /dev/null; then
51-
for plugin_path in "$plugins_path"/* ; do
50+
if ls "$plugins_path" &>/dev/null; then
51+
for plugin_path in "$plugins_path"/*; do
5252
local plugin_name
5353
plugin_name=$(basename "$plugin_path")
5454

@@ -58,7 +58,7 @@ install_local_tool_versions() {
5858
if [ -n "$plugin_version_and_path" ]; then
5959
local plugin_version
6060
some_tools_installed='yes'
61-
plugin_versions=$(cut -d '|' -f 1 <<< "$plugin_version_and_path")
61+
plugin_versions=$(cut -d '|' -f 1 <<<"$plugin_version_and_path")
6262
for plugin_version in $plugin_versions; do
6363
install_tool_version "$plugin_name" "$plugin_version"
6464
done
@@ -77,7 +77,6 @@ install_local_tool_versions() {
7777
fi
7878
}
7979

80-
8180
install_tool_version() {
8281
local plugin_name=$1
8382
local full_version=$2
@@ -89,7 +88,7 @@ install_tool_version() {
8988
return
9089
fi
9190

92-
IFS=':' read -r -a version_info <<< "$full_version"
91+
IFS=':' read -r -a version_info <<<"$full_version"
9392
if [ "${version_info[0]}" = "ref" ]; then
9493
local install_type="${version_info[0]}"
9594
local version="${version_info[1]}"
@@ -105,7 +104,6 @@ install_tool_version() {
105104
fi
106105
fi
107106

108-
109107
local install_path
110108
install_path=$(get_install_path "$plugin_name" "$install_type" "$version")
111109
local concurrency

‎lib/commands/command-latest

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ latest_command() {
99
[[ -z $query ]] && query="$DEFAULT_QUERY"
1010

1111
# pattern from xxenv-latest (https://github.com/momo-lab/xxenv-latest)
12-
asdf list-all "$plugin_name" "$query" \
13-
| grep -vE "(^Available versions:|-src|-dev|-latest|-stm|[-\.]rc|-alpha|-beta|[-\.]pre|-next|(a|b|c)[0-9]+|snapshot|master)" \
14-
| sed 's/^\s\+//' \
15-
| sort --version-sort \
16-
| tail -1
12+
asdf list-all "$plugin_name" "$query" |
13+
grep -vE "(^Available versions:|-src|-dev|-latest|-stm|[-\.]rc|-alpha|-beta|[-\.]pre|-next|(a|b|c)[0-9]+|snapshot|master)" |
14+
sed 's/^\s\+//' |
15+
sort --version-sort |
16+
tail -1
1717
}
1818

1919
latest_command "$@"

‎lib/commands/command-list

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ list_command() {
77
local plugins_path
88
plugins_path=$(get_plugin_path)
99

10-
if ls "$plugins_path" &> /dev/null; then
11-
for plugin_path in "$plugins_path"/* ; do
10+
if ls "$plugins_path" &>/dev/null; then
11+
for plugin_path in "$plugins_path"/*; do
1212
plugin_name=$(basename "$plugin_path")
1313
echo "$plugin_name"
1414
display_installed_versions "$plugin_name"

‎lib/commands/command-list-all

+6-7
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ list_all_command() {
1111
versions=$(bash "${plugin_path}/bin/list-all")
1212

1313
if [[ $query ]]; then
14-
versions=$(echo "$versions" \
15-
| tr ' ' '\n' \
16-
| grep -E "^\s*$query" \
17-
| tr '\n' ' ')
14+
versions=$(echo "$versions" |
15+
tr ' ' '\n' |
16+
grep -E "^\s*$query" |
17+
tr '\n' ' ')
1818
fi
1919

20-
IFS=' ' read -r -a versions_list <<< "$versions"
20+
IFS=' ' read -r -a versions_list <<<"$versions"
2121

22-
for version in "${versions_list[@]}"
23-
do
22+
for version in "${versions_list[@]}"; do
2423
echo "${version}"
2524
done
2625
}

‎lib/commands/command-local

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ local_command() {
77
local parent=false
88
local positional=()
99

10-
while [[ $# -gt 0 ]]
11-
do
10+
while [[ $# -gt 0 ]]; do
1211
case $1 in
13-
-p|--parent)
12+
-p | --parent)
1413
parent="true"
1514
shift # past value
1615
;;
1716
*)
1817
positional+=("$1") # save it in an array for later
19-
shift # past argument
18+
shift # past argument
2019
;;
2120
esac
2221
done

‎lib/commands/command-plugin-list

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ plugin_list_command() {
1010
local plugins_path
1111
plugins_path=$(get_plugin_path)
1212

13-
if ls "$plugins_path" &> /dev/null; then
14-
for plugin_path in "$plugins_path"/* ; do
13+
if ls "$plugins_path" &>/dev/null; then
14+
for plugin_path in "$plugins_path"/*; do
1515
plugin_name=$(basename "$plugin_path")
1616

1717
if [ $# -eq 0 ]; then

‎lib/commands/command-plugin-list-all

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugin_list_all_command() {
99
local plugins_local_path
1010
plugins_local_path="$(get_plugin_path)"
1111

12-
if ls "$plugins_index_path" &> /dev/null; then
12+
if ls "$plugins_index_path" &>/dev/null; then
1313
for index_plugin in "$plugins_index_path"/*; do
1414
index_plugin_name=$(basename "$index_plugin")
1515
source_url=$(get_plugin_source_url "$index_plugin_name")

‎lib/commands/command-plugin-test

+141-144
Original file line numberDiff line numberDiff line change
@@ -2,156 +2,153 @@
22

33
plugin_test_command() {
44

5-
local plugin_name=$1
6-
local plugin_url=$2
7-
local plugin_command_array=()
8-
local plugin_command
9-
local tool_version
10-
# shellcheck disable=SC2086
11-
set -- ${*:3}
12-
13-
while [[ $# -gt 0 ]]
14-
do
15-
case $1 in
16-
--asdf-tool-version)
17-
tool_version=$2
18-
shift # past flag
19-
shift # past value
20-
;;
21-
*)
22-
plugin_command_array+=("$1") # save it in an array for later
23-
shift # past argument
24-
;;
25-
esac
26-
done
5+
local plugin_name=$1
6+
local plugin_url=$2
7+
local plugin_command_array=()
8+
local plugin_command
9+
local tool_version
10+
# shellcheck disable=SC2086
11+
set -- ${*:3}
12+
13+
while [[ $# -gt 0 ]]; do
14+
case $1 in
15+
--asdf-tool-version)
16+
tool_version=$2
17+
shift # past flag
18+
shift # past value
19+
;;
20+
*)
21+
plugin_command_array+=("$1") # save it in an array for later
22+
shift # past argument
23+
;;
24+
esac
25+
done
26+
27+
plugin_command="${plugin_command_array[*]}"
28+
29+
local exit_code
30+
local TEST_DIR
31+
32+
fail_test() {
33+
echo "FAILED: $1"
34+
rm -rf "$TEST_DIR"
35+
exit 1
36+
}
2737

28-
plugin_command="${plugin_command_array[*]}"
38+
if [ -z "$plugin_name" ] || [ -z "$plugin_url" ]; then
39+
fail_test "please provide a plugin name and url"
40+
fi
2941

30-
local exit_code
31-
local TEST_DIR
42+
TEST_DIR=$(mktemp -dt asdf.XXXX)
43+
cp -R "$ASDF_DIR/bin" "$TEST_DIR"
44+
cp -R "$ASDF_DIR/lib" "$TEST_DIR"
45+
cp "$ASDF_DIR/asdf.sh" "$TEST_DIR"
3246

33-
fail_test() {
34-
echo "FAILED: $1"
35-
rm -rf "$TEST_DIR"
36-
exit 1
37-
}
47+
plugin_test() {
48+
export ASDF_DIR=$TEST_DIR
49+
export ASDF_DATA_DIR=$TEST_DIR
3850

39-
if [ -z "$plugin_name" ] || [ -z "$plugin_url" ]; then
40-
fail_test "please provide a plugin name and url"
51+
# shellcheck disable=SC1090
52+
source "$ASDF_DIR/asdf.sh"
53+
54+
if ! (asdf plugin-add "$plugin_name" "$plugin_url"); then
55+
fail_test "could not install $plugin_name from $plugin_url"
4156
fi
4257

43-
TEST_DIR=$(mktemp -dt asdf.XXXX)
44-
cp -R "$ASDF_DIR/bin" "$TEST_DIR"
45-
cp -R "$ASDF_DIR/lib" "$TEST_DIR"
46-
cp "$ASDF_DIR/asdf.sh" "$TEST_DIR"
47-
48-
plugin_test() {
49-
export ASDF_DIR=$TEST_DIR
50-
export ASDF_DATA_DIR=$TEST_DIR
51-
52-
# shellcheck disable=SC1090
53-
source "$ASDF_DIR/asdf.sh"
54-
55-
if ! (asdf plugin-add "$plugin_name" "$plugin_url"); then
56-
fail_test "could not install $plugin_name from $plugin_url"
57-
fi
58-
59-
if ! (asdf plugin-list | grep "^$plugin_name$" > /dev/null); then
60-
fail_test "$plugin_name was not properly installed"
61-
fi
62-
63-
64-
local plugin_path
65-
plugin_path=$(get_plugin_path "$plugin_name")
66-
local list_all="$plugin_path/bin/list-all"
67-
if grep api.github.com "$list_all" >/dev/null; then
68-
if ! grep Authorization "$list_all" >/dev/null; then
69-
echo
70-
echo "Looks like ${plugin_name}/bin/list-all relies on GitHub releases"
71-
echo "but it does not properly sets an Authorization header to prevent"
72-
echo "GitHub API rate limiting."
73-
echo
74-
echo "See https://github.com/asdf-vm/asdf/blob/master/docs/creating-plugins.md#github-api-rate-limiting"
75-
76-
fail_test "$plugin_name/bin/list-all does not set GitHub Authorization token"
77-
fi
78-
79-
# test for most common token names we have on plugins. If both are empty show this warning
80-
if [ -z "$OAUTH_TOKEN" ] && [ -z "$GITHUB_API_TOKEN" ] ; then
81-
echo "$plugin_name/bin/list-all is using GitHub API, just be sure you provide an API Authorization token"
82-
echo "via your travis settings. This is the current rate_limit:"
83-
echo
84-
curl -s https://api.github.com/rate_limit
85-
echo
86-
fi
87-
fi
88-
89-
local versions
90-
# shellcheck disable=SC2046
91-
if ! read -r -a versions <<< $(asdf list-all "$plugin_name"); then
92-
fail_test "list-all exited with an error"
93-
fi
94-
95-
if [ ${#versions} -eq 0 ]; then
96-
fail_test "list-all did not return any version"
97-
fi
98-
99-
local version
100-
101-
# Use the version passed in if it was set. Otherwise grab the latest
102-
# version from the versions list
103-
if [ -n "$tool_version" ]; then
104-
version="$tool_version"
105-
else
106-
version="$(asdf latest "$plugin_name")"
107-
fi
108-
109-
if ! (asdf install "$plugin_name" "$version"); then
110-
fail_test "install exited with an error"
111-
fi
112-
113-
cd "$TEST_DIR" || fail_test "could not cd $TEST_DIR"
114-
115-
if ! (asdf local "$plugin_name" "$version"); then
116-
fail_test "install did not add the requested version"
117-
fi
118-
119-
if ! (asdf reshim "$plugin_name"); then
120-
fail_test "could not reshim plugin"
121-
fi
122-
123-
if [ -n "$plugin_command" ]; then
124-
$plugin_command
125-
exit_code=$?
126-
if [ $exit_code != 0 ]; then
127-
fail_test "$plugin_command failed with exit code $?"
128-
fi
129-
fi
130-
131-
# Assert the scripts in bin are executable by asdf
132-
for filename in "$ASDF_DIR/plugins/$plugin_name/bin"/*
133-
do
134-
if [ ! -x "$filename" ]; then
135-
fail_test "Incorrect permissions on $filename. Must be executable by asdf"
136-
fi
137-
done
138-
139-
# Assert that a license file exists in the plugin repo and is not empty
140-
license_file="$ASDF_DIR/plugins/$plugin_name/LICENSE"
141-
if [ -f "$license_file" ]; then
142-
if [ ! -s "$license_file" ]; then
143-
fail_test "LICENSE file in the plugin repository must not be empty"
144-
fi
145-
else
146-
fail_test "LICENSE file must be present in the plugin repository"
147-
fi
148-
}
149-
150-
# run test in a subshell
151-
(plugin_test)
152-
exit_code=$?
153-
rm -rf "$TEST_DIR"
154-
exit $exit_code
58+
if ! (asdf plugin-list | grep "^$plugin_name$" >/dev/null); then
59+
fail_test "$plugin_name was not properly installed"
60+
fi
61+
62+
local plugin_path
63+
plugin_path=$(get_plugin_path "$plugin_name")
64+
local list_all="$plugin_path/bin/list-all"
65+
if grep api.github.com "$list_all" >/dev/null; then
66+
if ! grep Authorization "$list_all" >/dev/null; then
67+
echo
68+
echo "Looks like ${plugin_name}/bin/list-all relies on GitHub releases"
69+
echo "but it does not properly sets an Authorization header to prevent"
70+
echo "GitHub API rate limiting."
71+
echo
72+
echo "See https://github.com/asdf-vm/asdf/blob/master/docs/creating-plugins.md#github-api-rate-limiting"
73+
74+
fail_test "$plugin_name/bin/list-all does not set GitHub Authorization token"
75+
fi
76+
77+
# test for most common token names we have on plugins. If both are empty show this warning
78+
if [ -z "$OAUTH_TOKEN" ] && [ -z "$GITHUB_API_TOKEN" ]; then
79+
echo "$plugin_name/bin/list-all is using GitHub API, just be sure you provide an API Authorization token"
80+
echo "via your travis settings. This is the current rate_limit:"
81+
echo
82+
curl -s https://api.github.com/rate_limit
83+
echo
84+
fi
85+
fi
86+
87+
local versions
88+
# shellcheck disable=SC2046
89+
if ! read -r -a versions <<<$(asdf list-all "$plugin_name"); then
90+
fail_test "list-all exited with an error"
91+
fi
92+
93+
if [ ${#versions} -eq 0 ]; then
94+
fail_test "list-all did not return any version"
95+
fi
96+
97+
local version
98+
99+
# Use the version passed in if it was set. Otherwise grab the latest
100+
# version from the versions list
101+
if [ -n "$tool_version" ]; then
102+
version="$tool_version"
103+
else
104+
version="$(asdf latest "$plugin_name")"
105+
fi
106+
107+
if ! (asdf install "$plugin_name" "$version"); then
108+
fail_test "install exited with an error"
109+
fi
110+
111+
cd "$TEST_DIR" || fail_test "could not cd $TEST_DIR"
112+
113+
if ! (asdf local "$plugin_name" "$version"); then
114+
fail_test "install did not add the requested version"
115+
fi
116+
117+
if ! (asdf reshim "$plugin_name"); then
118+
fail_test "could not reshim plugin"
119+
fi
120+
121+
if [ -n "$plugin_command" ]; then
122+
$plugin_command
123+
exit_code=$?
124+
if [ $exit_code != 0 ]; then
125+
fail_test "$plugin_command failed with exit code $?"
126+
fi
127+
fi
128+
129+
# Assert the scripts in bin are executable by asdf
130+
for filename in "$ASDF_DIR/plugins/$plugin_name/bin"/*; do
131+
if [ ! -x "$filename" ]; then
132+
fail_test "Incorrect permissions on $filename. Must be executable by asdf"
133+
fi
134+
done
135+
136+
# Assert that a license file exists in the plugin repo and is not empty
137+
license_file="$ASDF_DIR/plugins/$plugin_name/LICENSE"
138+
if [ -f "$license_file" ]; then
139+
if [ ! -s "$license_file" ]; then
140+
fail_test "LICENSE file in the plugin repository must not be empty"
141+
fi
142+
else
143+
fail_test "LICENSE file must be present in the plugin repository"
144+
fi
145+
}
146+
147+
# run test in a subshell
148+
(plugin_test)
149+
exit_code=$?
150+
rm -rf "$TEST_DIR"
151+
exit $exit_code
155152
}
156153

157154
plugin_test_command "$@"

‎lib/commands/command-reshim

+6-9
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ reshim_command() {
1111
local plugins_path
1212
plugins_path=$(get_plugin_path)
1313

14-
if ls "$plugins_path" &> /dev/null; then
15-
for plugin_path in "$plugins_path"/* ; do
14+
if ls "$plugins_path" &>/dev/null; then
15+
for plugin_path in "$plugins_path"/*; do
1616
plugin_name=$(basename "$plugin_path")
1717
reshim_command "$plugin_name"
1818
done
@@ -45,15 +45,13 @@ reshim_command() {
4545

4646
}
4747

48-
4948
ensure_shims_dir() {
5049
# Create shims dir if doesn't exist
5150
if [ ! -d "$(asdf_data_dir)/shims" ]; then
5251
mkdir "$(asdf_data_dir)/shims"
5352
fi
5453
}
5554

56-
5755
write_shim_script() {
5856
local plugin_name=$1
5957
local version=$2
@@ -71,11 +69,11 @@ write_shim_script() {
7169

7270
if [ -f "$shim_path" ]; then
7371
if ! grep -x "# asdf-plugin: ${plugin_name} ${version}" "$shim_path" >/dev/null; then
74-
sed -i.bak -e "s/exec /# asdf-plugin: ${plugin_name} ${version}\\"$'\n''exec /' "$shim_path"
75-
rm "$shim_path".bak
72+
sed -i.bak -e "s/exec /# asdf-plugin: ${plugin_name} ${version}\\"$'\n''exec /' "$shim_path"
73+
rm "$shim_path".bak
7674
fi
7775
else
78-
cat <<EOF > "$shim_path"
76+
cat <<EOF >"$shim_path"
7977
#!/usr/bin/env bash
8078
# asdf-plugin: ${plugin_name} ${version}
8179
exec $(asdf_dir)/bin/asdf exec "${executable_name}" "\$@"
@@ -85,15 +83,14 @@ EOF
8583
chmod +x "$shim_path"
8684
}
8785

88-
8986
generate_shim_for_executable() {
9087
local plugin_name=$1
9188
local executable=$2
9289

9390
check_if_plugin_exists "$plugin_name"
9491

9592
local version
96-
IFS=':' read -r -a version_info <<< "$full_version"
93+
IFS=':' read -r -a version_info <<<"$full_version"
9794
if [ "${version_info[0]}" = "ref" ]; then
9895
version="${version_info[1]}"
9996
else

‎lib/commands/command-uninstall

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ uninstall_command() {
1111

1212
check_if_plugin_exists "$plugin_name"
1313

14-
IFS=':' read -r -a version_info <<< "$full_version"
14+
IFS=':' read -r -a version_info <<<"$full_version"
1515
if [ "${version_info[0]}" = "ref" ]; then
1616
local install_type="${version_info[0]}"
1717
local version="${version_info[1]}"
@@ -53,5 +53,4 @@ remove_shims_for_version() {
5353
done
5454
}
5555

56-
5756
uninstall_command "$@"

‎lib/commands/command-update

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ update_command() {
44
local update_to_head=$1
55

66
(
7-
cd "$(asdf_dir)" || exit 1
7+
cd "$(asdf_dir)" || exit 1
88

9-
if [ -f asdf_updates_disabled ] || ! git rev-parse --is-inside-work-tree &> /dev/null; then
10-
echo "Update command disabled. Please use the package manager that you used to install asdf to upgrade asdf."
11-
exit 1
12-
else
13-
do_update "$update_to_head"
14-
fi
9+
if [ -f asdf_updates_disabled ] || ! git rev-parse --is-inside-work-tree &>/dev/null; then
10+
echo "Update command disabled. Please use the package manager that you used to install asdf to upgrade asdf."
11+
exit 1
12+
else
13+
do_update "$update_to_head"
14+
fi
1515
)
1616
}
1717

@@ -45,8 +45,8 @@ do_update() {
4545

4646
# stolen from https://github.com/rbenv/ruby-build/pull/631/files#diff-fdcfb8a18714b33b07529b7d02b54f1dR942
4747
sort_versions() {
48-
sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' | \
49-
LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}'
48+
sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' |
49+
LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}'
5050
}
5151

5252
update_command "$@"

‎lib/commands/command-where

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ where_command() {
1010
if [[ -z ${full_version} ]]; then
1111
local version_and_path
1212
version_and_path=$(find_versions "$plugin_name" "$PWD")
13-
version=$(cut -d '|' -f 1 <<< "$version_and_path");
13+
version=$(cut -d '|' -f 1 <<<"$version_and_path")
1414
else
1515
local -a version_info
16-
IFS=':' read -r -a version_info <<< "$full_version"
16+
IFS=':' read -r -a version_info <<<"$full_version"
1717
if [ "${version_info[0]}" = "ref" ]; then
1818
install_type="${version_info[0]}"
1919
version="${version_info[1]}"

‎lib/commands/reshim.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
remove_shim_for_version() {
32
local plugin_name=$1
43
local version=$2
@@ -12,15 +11,15 @@ remove_shim_for_version() {
1211
local count_installed
1312
count_installed=$(list_installed_versions "$plugin_name" | wc -l)
1413

15-
if ! grep -x "# asdf-plugin: $plugin_name $version" "$shim_path" > /dev/null 2>&1; then
14+
if ! grep -x "# asdf-plugin: $plugin_name $version" "$shim_path" >/dev/null 2>&1; then
1615
return 0
1716
fi
1817

1918
sed -i.bak -e "/# asdf-plugin: $plugin_name $version"'$/d' "$shim_path"
2019
rm "$shim_path".bak
2120

22-
if ! grep "# asdf-plugin:" "$shim_path" > /dev/null || \
23-
[ "$count_installed" -eq 0 ]; then
21+
if ! grep "# asdf-plugin:" "$shim_path" >/dev/null ||
22+
[ "$count_installed" -eq 0 ]; then
2423
rm "$shim_path"
2524
fi
2625
}

‎lib/commands/version_commands.sh

+4-5
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ version_command() {
2626
fi
2727

2828
if [ -L "$file" ]; then
29-
# Resolve file path if symlink
30-
file="$(resolve_symlink "$file")"
29+
# Resolve file path if symlink
30+
file="$(resolve_symlink "$file")"
3131
fi
3232

3333
check_if_plugin_exists "$plugin"
@@ -37,11 +37,10 @@ version_command() {
3737
check_if_version_exists "$plugin" "$version"
3838
done
3939

40-
41-
if [ -f "$file" ] && grep "^$plugin " "$file" > /dev/null; then
40+
if [ -f "$file" ] && grep "^$plugin " "$file" >/dev/null; then
4241
sed -i.bak -e "s|^$plugin .*$|$plugin ${versions[*]}|" "$file"
4342
rm "$file".bak
4443
else
45-
echo "$plugin ${versions[*]}" >> "$file"
44+
echo "$plugin ${versions[*]}" >>"$file"
4645
fi
4746
}

‎lib/utils.sh

+31-31
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ asdf_dir() {
2222
if [ -z "$ASDF_DIR" ]; then
2323
local current_script_path=${BASH_SOURCE[0]}
2424
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+
)
2629
fi
2730

2831
echo "$ASDF_DIR"
@@ -32,9 +35,9 @@ asdf_repository_url() {
3235
echo "https://github.com/asdf-vm/asdf-plugins.git"
3336
}
3437

35-
asdf_data_dir(){
38+
asdf_data_dir() {
3639
local data_dir
37-
40+
3841
if [ -n "${ASDF_DATA_DIR}" ]; then
3942
data_dir="${ASDF_DATA_DIR}"
4043
elif [[ $EUID -ne 0 ]]; then
@@ -56,8 +59,7 @@ get_install_path() {
5659

5760
mkdir -p "${install_dir}/${plugin}"
5861

59-
if [ "$install_type" = "version" ]
60-
then
62+
if [ "$install_type" = "version" ]; then
6163
echo "${install_dir}/${plugin}/${version}"
6264
else
6365
echo "${install_dir}/${plugin}/${install_type}-${version}"
@@ -149,12 +151,12 @@ find_versions() {
149151
local version
150152
version=$(get_version_from_env "$plugin_name")
151153
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"
155157

156-
echo "$version|$version_env_var environment variable"
157-
return 0
158+
echo "$version|$version_env_var environment variable"
159+
return 0
158160
fi
159161

160162
local plugin_path
@@ -194,7 +196,7 @@ display_no_version_set() {
194196
echo "No version set for ${plugin_name}; please run \`asdf <global | local> ${plugin_name} <version>\`"
195197
}
196198

197-
get_version_from_env () {
199+
get_version_from_env() {
198200
local plugin_name=$1
199201
local upcase_name
200202
upcase_name=$(echo "$plugin_name" | tr '[:lower:]-' '[:upper:]_')
@@ -208,7 +210,7 @@ find_install_path() {
208210
local version=$2
209211

210212
# shellcheck disable=SC2162
211-
IFS=':' read -a version_info <<< "$version"
213+
IFS=':' read -a version_info <<<"$version"
212214

213215
if [ "$version" = "system" ]; then
214216
echo ""
@@ -278,7 +280,7 @@ parse_asdf_version_file() {
278280

279281
if [ -f "$file_path" ]; then
280282
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} //")
282284
if [ -n "$version" ]; then
283285
echo "$version"
284286
return 0
@@ -311,7 +313,7 @@ get_preset_version_for() {
311313
local version_and_path
312314
version_and_path=$(find_versions "$plugin_name" "$search_path")
313315
local version
314-
version=$(cut -d '|' -f 1 <<< "$version_and_path");
316+
version=$(cut -d '|' -f 1 <<<"$version_and_path")
315317

316318
echo "$version"
317319
}
@@ -383,7 +385,6 @@ get_plugin_source_url() {
383385

384386
plugin_config="$(asdf_data_dir)/repository/plugins/$plugin_name"
385387

386-
387388
if [ -f "$plugin_config" ]; then
388389
grep "repository" "$plugin_config" | awk -F'=' '{print $2}' | sed 's/ //'
389390
fi
@@ -399,8 +400,8 @@ find_file_upwards() {
399400
search_path=$(pwd)
400401
while [ "$search_path" != "/" ]; do
401402
if [ -f "$search_path/$name" ]; then
402-
echo "${search_path}/$name"
403-
return 0
403+
echo "${search_path}/$name"
404+
return 0
404405
fi
405406
search_path=$(dirname "$search_path")
406407
done
@@ -446,7 +447,7 @@ list_plugin_bin_paths() {
446447
export ASDF_INSTALL_VERSION=$version
447448
export ASDF_INSTALL_PATH=$install_path
448449
bash "${plugin_path}/bin/list-bin-paths"
449-
)
450+
)
450451
else
451452
local space_separated_list_of_bin_paths="bin"
452453
fi
@@ -458,7 +459,7 @@ list_plugin_exec_paths() {
458459
local full_version=$2
459460
check_if_plugin_exists "$plugin_name"
460461

461-
IFS=':' read -r -a version_info <<< "$full_version"
462+
IFS=':' read -r -a version_info <<<"$full_version"
462463
if [ "${version_info[0]}" = "ref" ]; then
463464
local install_type="${version_info[0]}"
464465
local version="${version_info[1]}"
@@ -474,7 +475,7 @@ list_plugin_exec_paths() {
474475
fi
475476

476477
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"
478479

479480
local install_path
480481
install_path=$(get_install_path "$plugin_name" "$install_type" "$version")
@@ -489,7 +490,7 @@ with_plugin_env() {
489490
local full_version=$2
490491
local callback=$3
491492

492-
IFS=':' read -r -a version_info <<< "$full_version"
493+
IFS=':' read -r -a version_info <<<"$full_version"
493494
if [ "${version_info[0]}" = "ref" ]; then
494495
local install_type="${version_info[0]}"
495496
local version="${version_info[1]}"
@@ -546,7 +547,6 @@ plugin_executables() {
546547
done
547548
}
548549

549-
550550
is_executable() {
551551
local executable_path=$1
552552
if [[ (-f "$executable_path") && (-x "$executable_path") ]]; then
@@ -585,7 +585,7 @@ strip_tool_version_comments() {
585585
if [[ -n "$new_line" ]]; then
586586
echo "$new_line"
587587
fi
588-
done < "$tool_version_path"
588+
done <"$tool_version_path"
589589
}
590590

591591
asdf_run_hook() {
@@ -625,15 +625,15 @@ with_shim_executable() {
625625
local search_path
626626
search_path=$(pwd)
627627
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)"
629629

630630
local plugins
631631
plugins=()
632632

633633
for plugin_and_version in "${shim_versions[@]}"; do
634634
local plugin_name
635635
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"
637637
if ! [[ " ${plugins[*]} " == *" $plugin_name "* ]]; then
638638
plugins+=("$plugin_name")
639639
fi
@@ -645,15 +645,15 @@ with_shim_executable() {
645645
local usable_plugin_versions
646646
local _path
647647
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"
650650
for plugin_version in "${usable_plugin_versions[@]}"; do
651651
for plugin_and_version in "${shim_versions[@]}"; do
652652
local plugin_shim_name
653653
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
657657
echo "$plugin_name $plugin_version"
658658
return
659659
fi
@@ -683,7 +683,7 @@ with_shim_executable() {
683683
local full_version
684684
local plugin_path
685685

686-
IFS=' ' read -r plugin_name full_version <<< "$selected_version"
686+
IFS=' ' read -r plugin_name full_version <<<"$selected_version"
687687
plugin_path=$(get_plugin_path "$plugin_name")
688688

689689
run_within_env() {

‎lint.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22
exec shellcheck -s bash -x \
3-
asdf.sh lint.sh release/tag.sh \
4-
bin/asdf bin/private/asdf-exec \
5-
lib/utils.sh lib/commands/* \
6-
completions/*.bash \
7-
test/test_helpers.bash \
8-
test/fixtures/dummy_plugin/bin/*
3+
asdf.sh lint.sh release/tag.sh \
4+
bin/asdf bin/private/asdf-exec \
5+
lib/utils.sh lib/commands/* \
6+
completions/*.bash \
7+
test/test_helpers.bash \
8+
test/fixtures/dummy_plugin/bin/*

‎prepare-travis.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
# Fish is needed for the tests for asdf.fish
77

88
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
9-
brew update;
10-
brew install shellcheck;
9+
brew update
10+
brew install shellcheck
1111

1212
brew update
1313
brew instal fish
14-
elif [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
14+
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
1515
${FISH_PPA:="nightly-master"}
1616
PPA="ppa:fish-shell/$FISH_PPA"
1717

‎release/tag.sh

+23-24
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ IFS=$'\t\n' # Stricter IFS settings
88

99
# shellcheck disable=SC2006
1010
usage() {
11-
cat <<EOF
11+
cat <<EOF
1212
1313
Usage: tag.sh [new version]
1414
@@ -25,7 +25,7 @@ reflog:
2525
2626
git reflog
2727
28-
Then revert to the original state by running `git checkout` with the reference
28+
Then revert to the original state by running $(git checkout) with the reference
2929
previous to the release tagging changes:
3030
3131
git checkout HEAD@{21}
@@ -40,41 +40,40 @@ EOF
4040
}
4141

4242
error_exit() {
43-
usage
44-
exit 1
43+
usage
44+
exit 1
4545
}
4646

4747
new_version="${1:-}"
4848
new_tag_name="v$new_version"
4949

5050
# Make sure the user provides a version
51-
if [[ -z "$new_version" ]]
52-
then
53-
echo "ERROR: no new version specified"
54-
error_exit
51+
if [[ -z "$new_version" ]]; then
52+
echo "ERROR: no new version specified"
53+
error_exit
5554
fi
5655

5756
# Make sure version passed in is a plain semantic version to guard against
5857
# leading 'v'.
5958
if ! [[ "${new_version:0:1}" =~ ^[0-9]+$ ]]; then
60-
echo >&2 "ERROR: semantic version should not start with a letter"
61-
error_exit
59+
echo >&2 "ERROR: semantic version should not start with a letter"
60+
error_exit
6261
fi
6362

6463
# Make sure the version the user provided hasn't already been tagged
65-
if git tag | grep "$new_tag_name" > /dev/null; then
66-
echo >&2 "ERROR: git tag with that version already exists"
67-
exit 1
64+
if git tag | grep "$new_tag_name" >/dev/null; then
65+
echo >&2 "ERROR: git tag with that version already exists"
66+
exit 1
6867
fi
6968

7069
# If not a release candidate version
7170
if ! (echo "$new_version" | grep -i "rc"); then
7271
# Make sure an RC already exists when tagging a major or minor version
7372
new_major_and_minor=$(echo "$new_version" | cut -d. -f1,2)
74-
if ! git tag | grep "^v$new_major_and_minor.[0-9]*$" > /dev/null; then
73+
if ! git tag | grep "^v$new_major_and_minor.[0-9]*$" >/dev/null; then
7574
# If the major and minor versions don't already exist, make sure this release
7675
# is preceded by an RC release
77-
if ! git tag | grep "^v$new_major_and_minor.[0-9]*-rc[0-9]*$" > /dev/null; then
76+
if ! git tag | grep "^v$new_major_and_minor.[0-9]*-rc[0-9]*$" >/dev/null; then
7877
echo >&2 "ERROR: New major and minor versions must be preceded by an RC version"
7978
exit 1
8079
fi
@@ -83,31 +82,31 @@ fi
8382

8483
# Make sure the changelog already contains details on the new version
8584
if ! grep "$new_version$" CHANGELOG.md; then
86-
echo >&2 "ERROR: changelog entry for this version is missing"
87-
exit 1
85+
echo >&2 "ERROR: changelog entry for this version is missing"
86+
exit 1
8887
fi
8988

9089
# Make sure the changelog doesn't contain duplicate issue numbers
9190
nonunique_issue_numbers=$(grep -o -P '#[\d]+' CHANGELOG.md | sort)
9291
unique_issue_numbers=$(grep -o -P '#[\d]+' CHANGELOG.md | sort -u)
9392
if [ "$nonunique_issue_numbers" != "$unique_issue_numbers" ]; then
94-
echo >&2 "ERROR: Duplicate issue numbers in changelog."
95-
exit 1
93+
echo >&2 "ERROR: Duplicate issue numbers in changelog."
94+
exit 1
9695
fi
9796

9897
echo "INFO: Checking that all changes are commited and pushed"
9998
git pull
10099

101100
# Disallow unstaged changes in the working tree
102101
if ! git diff-files --check --exit-code --ignore-submodules -- >&2; then
103-
echo >&2 "ERROR: You have unstaged changes."
104-
exit 1
102+
echo >&2 "ERROR: You have unstaged changes."
103+
exit 1
105104
fi
106105

107106
# Disallow uncommitted changes in the index
108107
if ! git diff-index --cached --exit-code -r --ignore-submodules HEAD -- >&2; then
109-
echo >&2 "ERROR: Your index contains uncommitted changes."
110-
exit 1
108+
echo >&2 "ERROR: Your index contains uncommitted changes."
109+
exit 1
111110
fi
112111

113112
# Update version in README
@@ -119,7 +118,7 @@ sed -i.bak "s|^\\(git clone.*--branch \\).*$|\\1$new_tag_name|" docs/core-manage
119118
rm docs/core-manage-asdf-vm.md.bak
120119

121120
# Update version in the VERSION file
122-
echo "$new_tag_name" > VERSION
121+
echo "$new_tag_name" >VERSION
123122

124123
echo "INFO: Committing and tagging new version"
125124

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#!/usr/bin/env bash
22

33
mkdir -p "$ASDF_INSTALL_PATH"
4-
env > "$ASDF_INSTALL_PATH/env"
5-
echo "$ASDF_INSTALL_VERSION" > "$ASDF_INSTALL_PATH/version"
4+
env >"$ASDF_INSTALL_PATH/env"
5+
echo "$ASDF_INSTALL_VERSION" >"$ASDF_INSTALL_PATH/version"
66

77
# create the dummy executable
88
mkdir -p "$ASDF_INSTALL_PATH/bin"
9-
cat <<EOF > "$ASDF_INSTALL_PATH/bin/dummy"
9+
cat <<EOF >"$ASDF_INSTALL_PATH/bin/dummy"
1010
echo This is Dummy ${ASDF_INSTALL_VERSION}! \$2 \$1
1111
EOF
1212
chmod +x "$ASDF_INSTALL_PATH/bin/dummy"
1313
mkdir -p "$ASDF_INSTALL_PATH/bin/subdir"
14-
cat <<EOF > "$ASDF_INSTALL_PATH/bin/subdir/other_bin"
14+
cat <<EOF >"$ASDF_INSTALL_PATH/bin/subdir/other_bin"
1515
echo This is Other Bin ${ASDF_INSTALL_VERSION}! \$2 \$1
1616
EOF
17-
chmod +x "$ASDF_INSTALL_PATH/bin/subdir/other_bin"
17+
chmod +x "$ASDF_INSTALL_PATH/bin/subdir/other_bin"
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env bash
22

33
# shellcheck disable=SC2020
4-
< "$1" tr -d "dummy-"
4+
tr <"$1" -d "dummy-"

‎test/test_helpers.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ install_dummy_exec_path_script() {
4545
mkdir "$custom_dir"
4646
touch "$custom_dir/$name"
4747
chmod +x "$custom_dir/$name"
48-
echo "echo 'bin/custom/$name'" > "$exec_path"
48+
echo "echo 'bin/custom/$name'" >"$exec_path"
4949
chmod +x "$exec_path"
5050
}
5151

0 commit comments

Comments
 (0)
Please sign in to comment.