From 28cc3a64c55150820f1af99ff51b5cf8e4c353e0 Mon Sep 17 00:00:00 2001 From: Peter Wilcsinszky Date: Sat, 20 May 2023 11:10:16 +0200 Subject: [PATCH] lint fixes Signed-off-by: Peter Wilcsinszky --- bin/download | 2 +- bin/install | 2 +- bin/latest-stable | 2 +- bin/list-all | 2 +- lib/utils.bash | 46 +++++++++++++++++++++++----------------------- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/bin/download b/bin/download index ded612f..74b3a47 100755 --- a/bin/download +++ b/bin/download @@ -5,7 +5,7 @@ set -euo pipefail current_script_path=${BASH_SOURCE[0]} plugin_dir=$(dirname "$(dirname "$current_script_path")") -# shellcheck source=../lib/utils.bash +# shellcheck source=lib/utils.bash source "${plugin_dir}/lib/utils.bash" mkdir -p "$ASDF_DOWNLOAD_PATH" diff --git a/bin/install b/bin/install index 9737a63..38d87c0 100755 --- a/bin/install +++ b/bin/install @@ -5,7 +5,7 @@ set -euo pipefail current_script_path=${BASH_SOURCE[0]} plugin_dir=$(dirname "$(dirname "$current_script_path")") -# shellcheck source=../lib/utils.bash +# shellcheck source=lib/utils.bash source "${plugin_dir}/lib/utils.bash" install_version "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH" diff --git a/bin/latest-stable b/bin/latest-stable index dd01f31..c1f0700 100755 --- a/bin/latest-stable +++ b/bin/latest-stable @@ -5,7 +5,7 @@ set -euo pipefail current_script_path=${BASH_SOURCE[0]} plugin_dir=$(dirname "$(dirname "$current_script_path")") -# shellcheck source=../lib/utils.bash +# shellcheck source=lib/utils.bash . "${plugin_dir}/lib/utils.bash" curl_opts=(-sI) diff --git a/bin/list-all b/bin/list-all index 943371e..a3fb25c 100755 --- a/bin/list-all +++ b/bin/list-all @@ -5,7 +5,7 @@ set -euo pipefail current_script_path=${BASH_SOURCE[0]} plugin_dir=$(dirname "$(dirname "$current_script_path")") -# shellcheck source=../lib/utils.bash +# shellcheck source=lib/utils.bash source "${plugin_dir}/lib/utils.bash" list_all_versions | sort_versions | xargs echo diff --git a/lib/utils.bash b/lib/utils.bash index 955e1df..682a88e 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -37,34 +37,34 @@ list_all_versions() { } get_machine_os() { - local OS - OS=$(uname -s | tr '[:upper:]' '[:lower:]') - - case "${OS}" in - darwin*) echo "darwin" ;; - linux*) echo "linux" ;; - *) fail "OS not supported: ${OS}" ;; - esac + local OS + OS=$(uname -s | tr '[:upper:]' '[:lower:]') + + case "${OS}" in + darwin*) echo "darwin" ;; + linux*) echo "linux" ;; + *) fail "OS not supported: ${OS}" ;; + esac } get_machine_arch() { - local ARCH - ARCH=$(uname -m | tr '[:upper:]' '[:lower:]') - - case "${ARCH}" in - i?86) echo "386" ;; - x86_64) echo "amd64" ;; - aarch64) echo "arm64" ;; - armv8l) echo "arm64" ;; - arm64) echo "arm64" ;; - *) fail "Architecture not supported: $ARCH" ;; - esac + local ARCH + ARCH=$(uname -m | tr '[:upper:]' '[:lower:]') + + case "${ARCH}" in + i?86) echo "386" ;; + x86_64) echo "amd64" ;; + aarch64) echo "arm64" ;; + armv8l) echo "arm64" ;; + arm64) echo "arm64" ;; + *) fail "Architecture not supported: $ARCH" ;; + esac } download_release() { - local version filename url - version="$1" - name="$2" + local version url + name="$1" + version="$2" os=$(get_machine_os) arch=$(get_machine_arch) release_file="$ASDF_DOWNLOAD_PATH/${name}_${version}.tar.gz" @@ -78,7 +78,7 @@ download_release() { tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file" # Remove the tar.gz file since we don't need to keep it - rm "$release_file" + rm "$release_file" } install_version() {