mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
fix!: Remove files containing only asdf
wrapper functions (#1525)
This commit is contained in:
parent
8919f4009e
commit
00fee78423
16
asdf.fish
16
asdf.fish
@ -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
19
asdf.sh
@ -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
|
||||
}
|
||||
|
@ -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
|
20
lib/asdf.sh
20
lib/asdf.sh
@ -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
|
||||
}
|
@ -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 \
|
||||
|
@ -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 \
|
||||
|
Loading…
Reference in New Issue
Block a user