Update code to use . instead of source

This commit is contained in:
Trevor Brown 2021-05-21 12:03:06 -04:00
parent 5ca750edb2
commit f125741fb5
12 changed files with 23 additions and 23 deletions

View File

@ -9,7 +9,7 @@ set -l asdf_user_shims (
)
# Add asdf to PATH
set -l asdf_bin_dirs $ASDF_DIR/bin $asdf_user_shims
set -l asdf_bin_dirs $ASDF_DIR/bin $asdf_user_shims
for x in $asdf_bin_dirs
if test -d $x
@ -24,4 +24,4 @@ for x in $asdf_bin_dirs
end
# Load the asdf wrapper function
source $ASDF_DIR/lib/asdf.fish
. $ASDF_DIR/lib/asdf.fish

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# shellcheck source=lib/utils.bash
source "$(dirname "$(dirname "$0")")/lib/utils.bash"
. "$(dirname "$(dirname "$0")")/lib/utils.bash"
find_cmd() {
local cmd_dir="$1"
@ -74,12 +74,12 @@ asdf_cmd() {
exec "$ASDF_CMD_FILE" "${@:${args_offset}}"
elif [ -f "$ASDF_CMD_FILE" ]; then
set -- "${@:${args_offset}}"
source "$ASDF_CMD_FILE"
. "$ASDF_CMD_FILE"
else
local asdf_cmd_dir
asdf_cmd_dir="$(asdf_dir)/lib/commands"
printf "%s\\n" "Unknown command: \`asdf ${*}\`" >&2
source "$asdf_cmd_dir/command-help.bash" >&2
. "$asdf_cmd_dir/command-help.bash" >&2
return 127
fi
}

View File

@ -5,7 +5,7 @@ printf "asdf is self upgrading shims to new asdf exec ...\\n"
asdf_dir="$(dirname "$(dirname "$(dirname "$0")")")"
# shellcheck source=lib/utils.bash
source "$asdf_dir/lib/utils.bash"
. "$asdf_dir/lib/utils.bash"
rm "$(asdf_data_dir)"/shims/*
"$asdf_dir"/bin/asdf reshim
shim_name=$(basename "$2")

View File

@ -7,7 +7,7 @@ function asdf
switch "$command"
case "shell"
# source commands that need to export variables
source (asdf export-shell-version fish $argv | psub)
. (asdf export-shell-version fish $argv | psub)
case '*'
# forward other commands to asdf script
command asdf "$command" $argv

View File

@ -1,5 +1,5 @@
# -*- sh -*-
# shellcheck source=lib/commands/version_commands.bash
source "$(dirname "$ASDF_CMD_FILE")/version_commands.bash"
. "$(dirname "$ASDF_CMD_FILE")/version_commands.bash"
version_command global "$@"

View File

@ -1,7 +1,7 @@
# -*- sh -*-
# shellcheck source=lib/commands/version_commands.bash
source "$(dirname "$ASDF_CMD_FILE")/version_commands.bash"
. "$(dirname "$ASDF_CMD_FILE")/version_commands.bash"
local_command() {
local parent=false

View File

@ -55,7 +55,7 @@ plugin_test_command() {
export ASDF_DATA_DIR=$TEST_DIR
# shellcheck disable=SC1090
source "$ASDF_DIR/asdf.sh"
. "$ASDF_DIR/asdf.sh"
if ! (asdf plugin-add "$plugin_name" "$plugin_url"); then
fail_test "could not install $plugin_name from $plugin_url"

View File

@ -1,7 +1,7 @@
# -*- sh -*-
# shellcheck source=lib/commands/reshim.bash
source "$(dirname "$ASDF_CMD_FILE")/reshim.bash"
. "$(dirname "$ASDF_CMD_FILE")/reshim.bash"
reshim_command() {
local plugin_name=$1

View File

@ -1,7 +1,7 @@
# -*- sh -*-
# shellcheck source=lib/commands/reshim.bash
source "$(dirname "$ASDF_CMD_FILE")/reshim.bash"
. "$(dirname "$ASDF_CMD_FILE")/reshim.bash"
uninstall_command() {
local plugin_name=$1

View File

@ -566,7 +566,7 @@ with_plugin_env() {
ASDF_INSTALL_TYPE=$install_type \
ASDF_INSTALL_VERSION=$version \
ASDF_INSTALL_PATH=$install_path \
source "${plugin_path}/bin/exec-env"
. "${plugin_path}/bin/exec-env"
PATH=$path "$callback"
}
@ -658,7 +658,7 @@ get_shim_versions() {
preset_versions() {
shim_name=$1
shim_plugin_versions "${shim_name}" | cut -d' ' -f 1 | uniq | xargs -IPLUGIN bash -c "source $(asdf_dir)/lib/utils.bash; printf \"%s %s\\n\" PLUGIN \$(get_preset_version_for PLUGIN)"
shim_plugin_versions "${shim_name}" | cut -d' ' -f 1 | uniq | xargs -IPLUGIN bash -c ". $(asdf_dir)/lib/utils.bash; printf \"%s %s\\n\" PLUGIN \$(get_preset_version_for PLUGIN)"
}
select_from_preset_version() {

View File

@ -17,7 +17,7 @@ cleaned_path() {
set -e ASDF_DATA_DIR
set PATH $(cleaned_path)
source asdf.fish
. asdf.fish
echo \$ASDF_DIR
")
@ -32,7 +32,7 @@ cleaned_path() {
set -e ASDF_DATA_DIR
set PATH $(cleaned_path)
source (pwd)/asdf.fish # if the full path is not passed, status -f will return the relative path
. (pwd)/asdf.fish # if the full path is not passed, status -f will return the relative path
echo \$PATH
")
@ -48,8 +48,8 @@ cleaned_path() {
set -e ASDF_DATA_DIR
set PATH $(cleaned_path)
source asdf.fish
source asdf.fish
. asdf.fish
. asdf.fish
echo \$PATH
")
@ -64,7 +64,7 @@ cleaned_path() {
set -e ASDF_DIR
set PATH $(cleaned_path)
source asdf.fish
. asdf.fish
type asdf
")

View File

@ -231,14 +231,14 @@ teardown() {
}
@test "shell wrapper function should export ENV var" {
source $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
. $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
asdf shell "dummy" "1.1.0"
[ $(echo $ASDF_DUMMY_VERSION) = "1.1.0" ]
unset ASDF_DUMMY_VERSION
}
@test "shell wrapper function with --unset should unset ENV var" {
source $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
. $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
asdf shell "dummy" "1.1.0"
[ $(echo $ASDF_DUMMY_VERSION) = "1.1.0" ]
asdf shell "dummy" --unset
@ -247,7 +247,7 @@ teardown() {
}
@test "shell wrapper function should return an error for missing plugins" {
source $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
. $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
expected="No such plugin: nonexistent
version 1.0.0 is not installed for nonexistent"
@ -306,7 +306,7 @@ false"
}
@test "shell wrapper function should support latest" {
source $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
. $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
asdf shell "dummy" "latest"
[ $(echo $ASDF_DUMMY_VERSION) = "2.0.0" ]
unset ASDF_DUMMY_VERSION