fix: CI formatting use editorconfig (#751)

This commit is contained in:
James Hegedus 2020-06-30 09:16:35 +10:00 committed by GitHub
parent 1b7b4da0a6
commit 50feef2a77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 124 additions and 121 deletions

View File

@ -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 .

View File

@ -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
}

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}