mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
fix: CI formatting use editorconfig (#751)
This commit is contained in:
parent
1b7b4da0a6
commit
50feef2a77
5
.github/workflows/workflow.yml
vendored
5
.github/workflows/workflow.yml
vendored
@ -85,5 +85,8 @@ jobs:
|
||||
- name: Install shfmt
|
||||
run: brew install shfmt
|
||||
|
||||
- name: List file to shfmt
|
||||
run: shfmt -f .
|
||||
|
||||
- name: Run shfmt
|
||||
run: shfmt -d -i 2 -ci . lib/commands/*
|
||||
run: shfmt -d .
|
||||
|
28
bin/asdf
28
bin/asdf
@ -26,23 +26,23 @@ find_asdf_cmd() {
|
||||
local asdf_cmd_dir
|
||||
asdf_cmd_dir="$(asdf_dir)/lib/commands"
|
||||
case "$1" in
|
||||
'exec' | 'current' | 'env' | 'global' | 'install' | 'latest' | 'local' | \
|
||||
'reshim' | 'uninstall' | 'update' | 'where' | 'which' | \
|
||||
'export-shell-version')
|
||||
echo "$asdf_cmd_dir/command-$1.bash" 2
|
||||
;;
|
||||
'exec' | 'current' | 'env' | 'global' | 'install' | 'latest' | 'local' | \
|
||||
'reshim' | 'uninstall' | 'update' | 'where' | 'which' | \
|
||||
'export-shell-version')
|
||||
echo "$asdf_cmd_dir/command-$1.bash" 2
|
||||
;;
|
||||
|
||||
'' | '--help' | '-h' | 'help')
|
||||
echo "$asdf_cmd_dir/command-help.bash" 2
|
||||
;;
|
||||
'' | '--help' | '-h' | 'help')
|
||||
echo "$asdf_cmd_dir/command-help.bash" 2
|
||||
;;
|
||||
|
||||
'--version' | 'version')
|
||||
echo "$asdf_cmd_dir/command-version.bash" 2
|
||||
;;
|
||||
'--version' | 'version')
|
||||
echo "$asdf_cmd_dir/command-version.bash" 2
|
||||
;;
|
||||
|
||||
*)
|
||||
find_cmd "$asdf_cmd_dir" "$@"
|
||||
;;
|
||||
*)
|
||||
find_cmd "$asdf_cmd_dir" "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -15,51 +15,51 @@ _asdf() {
|
||||
COMPREPLY=()
|
||||
|
||||
case "$cmd" in
|
||||
plugin-update)
|
||||
plugin-update)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$plugins --all" -- "$cur"))
|
||||
;;
|
||||
plugin-remove | current | list | list-all)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
|
||||
;;
|
||||
plugin-add)
|
||||
local available_plugins
|
||||
available_plugins=$(asdf plugin-list-all 2>/dev/null | awk '{ if ($2 !~ /^\*/) print $1}')
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$available_plugins" -- "$cur"))
|
||||
;;
|
||||
install)
|
||||
if [[ "$plugins" == *"$prev"* ]]; then
|
||||
local versions
|
||||
versions=$(asdf list-all "$prev" 2>/dev/null)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$plugins --all" -- "$cur"))
|
||||
;;
|
||||
plugin-remove | current | list | list-all)
|
||||
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
|
||||
else
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
|
||||
;;
|
||||
plugin-add)
|
||||
local available_plugins
|
||||
available_plugins=$(asdf plugin-list-all 2>/dev/null | awk '{ if ($2 !~ /^\*/) print $1}')
|
||||
fi
|
||||
;;
|
||||
update)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "--head" -- "$cur"))
|
||||
;;
|
||||
uninstall | where | reshim | local | global | shell)
|
||||
if [[ "$plugins" == *"$prev"* ]]; then
|
||||
local versions
|
||||
versions=$(asdf list "$prev" 2>/dev/null)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$available_plugins" -- "$cur"))
|
||||
;;
|
||||
install)
|
||||
if [[ "$plugins" == *"$prev"* ]]; then
|
||||
local versions
|
||||
versions=$(asdf list-all "$prev" 2>/dev/null)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
|
||||
else
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
|
||||
fi
|
||||
;;
|
||||
update)
|
||||
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
|
||||
else
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "--head" -- "$cur"))
|
||||
;;
|
||||
uninstall | where | reshim | local | global | shell)
|
||||
if [[ "$plugins" == *"$prev"* ]]; then
|
||||
local versions
|
||||
versions=$(asdf list "$prev" 2>/dev/null)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
|
||||
else
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
local cmds='current global help install list list-all local plugin-add plugin-list plugin-list-all plugin-remove plugin-update reshim shell uninstall update where which '
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$cmds" -- "$cur"))
|
||||
;;
|
||||
COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
local cmds='current global help install list list-all local plugin-add plugin-list plugin-list-all plugin-remove plugin-update reshim shell uninstall update where which '
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$cmds" -- "$cur"))
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
|
16
lib/asdf.sh
16
lib/asdf.sh
@ -7,14 +7,14 @@ asdf() {
|
||||
fi
|
||||
|
||||
case "$command" in
|
||||
"shell")
|
||||
# commands that need to export variables
|
||||
eval "$(asdf export-shell-version sh "$@")" # asdf_allow: eval
|
||||
;;
|
||||
*)
|
||||
# forward other commands to asdf script
|
||||
command asdf "$command" "$@"
|
||||
;;
|
||||
"shell")
|
||||
# commands that need to export variables
|
||||
eval "$(asdf export-shell-version sh "$@")" # asdf_allow: eval
|
||||
;;
|
||||
*)
|
||||
# forward other commands to asdf script
|
||||
command asdf "$command" "$@"
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
@ -20,12 +20,12 @@ shell_command() {
|
||||
|
||||
if [ "$version" = "--unset" ]; then
|
||||
case "$asdf_shell" in
|
||||
fish)
|
||||
echo "set -e $version_env_var"
|
||||
;;
|
||||
*)
|
||||
echo "unset $version_env_var"
|
||||
;;
|
||||
fish)
|
||||
echo "set -e $version_env_var"
|
||||
;;
|
||||
*)
|
||||
echo "unset $version_env_var"
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
fi
|
||||
@ -35,12 +35,12 @@ shell_command() {
|
||||
fi
|
||||
|
||||
case "$asdf_shell" in
|
||||
fish)
|
||||
echo "set -gx $version_env_var \"$version\""
|
||||
;;
|
||||
*)
|
||||
echo "export $version_env_var=\"$version\""
|
||||
;;
|
||||
fish)
|
||||
echo "set -gx $version_env_var \"$version\""
|
||||
;;
|
||||
*)
|
||||
echo "export $version_env_var=\"$version\""
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -90,13 +90,13 @@ install_tool_version() {
|
||||
|
||||
for flag in $flags; do
|
||||
case "$flag" in
|
||||
"--keep-download")
|
||||
keep_download=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
"--keep-download")
|
||||
keep_download=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -9,14 +9,14 @@ local_command() {
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-p | --parent)
|
||||
parent="true"
|
||||
shift # past value
|
||||
;;
|
||||
*)
|
||||
positional+=("$1") # save it in an array for later
|
||||
shift # past argument
|
||||
;;
|
||||
-p | --parent)
|
||||
parent="true"
|
||||
shift # past value
|
||||
;;
|
||||
*)
|
||||
positional+=("$1") # save it in an array for later
|
||||
shift # past argument
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -9,17 +9,17 @@ plugin_list_command() {
|
||||
|
||||
while [ -n "$*" ]; do
|
||||
case "$1" in
|
||||
"--urls")
|
||||
show_repo=true
|
||||
shift
|
||||
;;
|
||||
"--refs")
|
||||
show_ref=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
"--urls")
|
||||
show_repo=true
|
||||
shift
|
||||
;;
|
||||
"--refs")
|
||||
show_ref=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -13,20 +13,20 @@ plugin_test_command() {
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--asdf-plugin-gitref)
|
||||
plugin_gitref="$2"
|
||||
shift # past flag
|
||||
shift # past value
|
||||
;;
|
||||
--asdf-tool-version)
|
||||
tool_version="$2"
|
||||
shift # past flag
|
||||
shift # past value
|
||||
;;
|
||||
*)
|
||||
plugin_command_array+=("$1") # save it in an array for later
|
||||
shift # past argument
|
||||
;;
|
||||
--asdf-plugin-gitref)
|
||||
plugin_gitref="$2"
|
||||
shift # past flag
|
||||
shift # past value
|
||||
;;
|
||||
--asdf-tool-version)
|
||||
tool_version="$2"
|
||||
shift # past flag
|
||||
shift # past value
|
||||
;;
|
||||
*)
|
||||
plugin_command_array+=("$1") # save it in an array for later
|
||||
shift # past argument
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -444,12 +444,12 @@ resolve_symlink() {
|
||||
# If it is a slash we can assume it's root and absolute. Otherwise we treat it
|
||||
# as relative
|
||||
case $resolved_path in
|
||||
/*)
|
||||
echo "$resolved_path"
|
||||
;;
|
||||
*)
|
||||
echo "$PWD/$resolved_path"
|
||||
;;
|
||||
/*)
|
||||
echo "$resolved_path"
|
||||
;;
|
||||
*)
|
||||
echo "$PWD/$resolved_path"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user