fix!: Remove files containing only asdf wrapper functions (#1525)

This commit is contained in:
Edwin Kofler 2023-03-31 20:22:24 -07:00 committed by GitHub
parent 8919f4009e
commit 00fee78423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 44 deletions

View File

@ -20,5 +20,17 @@ if not contains $_asdf_shims $fish_user_paths
end
set --erase _asdf_bin _asdf_shims
# Load the asdf wrapper function
. $ASDF_DIR/lib/asdf.fish
# The asdf function is a wrapper so we can export variables
function asdf
set command $argv[1]
set -e argv[1]
switch "$command"
case shell
# Source commands that need to export variables.
command asdf export-shell-version fish $argv | source # asdf_allow: source
case '*'
# Forward other commands to asdf script.
command asdf "$command" $argv
end
end

19
asdf.sh
View File

@ -70,6 +70,21 @@ esac
unset -v _asdf_bin _asdf_shims
# shellcheck source=lib/asdf.sh
. "$ASDF_DIR/lib/asdf.sh"
# The asdf function is a wrapper so we can export variables
asdf() {
case $1 in
"shell")
if ! shift; then
printf '%s\n' 'asdf: Error: Failed to shift' >&2
return 1
fi
# Invoke command that needs to export variables.
eval "$(asdf export-shell-version sh "$@")" # asdf_allow: eval
;;
*)
# Forward other commands to asdf script.
command asdf "$@" # asdf_allow: ' asdf '
;;
esac
}

View File

@ -1,14 +0,0 @@
# The asdf function is a wrapper so we can export variables
function asdf
set command $argv[1]
set -e argv[1]
switch "$command"
case shell
# Source commands that need to export variables.
command asdf export-shell-version fish $argv | source # asdf_allow: source
case '*'
# Forward other commands to asdf script.
command asdf "$command" $argv
end
end

View File

@ -1,20 +0,0 @@
# shellcheck shell=sh
# The asdf function is a wrapper so we can export variables
asdf() {
case $1 in
"shell")
if ! shift; then
printf '%s\n' 'asdf: Error: Failed to shift' >&2
return 1
fi
# Invoke command that needs to export variables.
eval "$(asdf export-shell-version sh "$@")" # asdf_allow: eval
;;
*)
# Forward other commands to asdf script.
command asdf "$@" # asdf_allow: ' asdf '
;;
esac
}

View File

@ -4,8 +4,7 @@ set -euo pipefail
# check .sh files
shellcheck --shell sh --external-sources \
asdf.sh \
lib/*.sh
asdf.sh
# check .bash files
shellcheck --shell bash --external-sources \

View File

@ -2,10 +2,6 @@
set -euo pipefail
# check .sh files
shfmt --language-dialect posix --indent 2 --diff \
lib/*.sh
# check .bash files
shfmt --language-dialect bash --indent 2 --diff \
completions/*.bash \