Skip to content

Commit

Permalink
fix issues found by shfmt and shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
kroleg committed Apr 10, 2024
1 parent ca667e0 commit 872c297
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
19 changes: 11 additions & 8 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ asdf_yarn_v1_download() {
}

asdf_yarn_v1_install() {
local ASDF_YARN_DIR="$(mktemp -d -t asdf-yarn-XXXXXXX)"
local ASDF_YARN_DIR
ASDF_DATA_DIR="$(mktemp -d -t asdf-yarn-XXXXXXX)"

(
cd "${ASDF_YARN_DIR}"
Expand Down Expand Up @@ -82,7 +83,8 @@ asdf_yarn_v1_install() {
}

asdf_yarn_v2_plus_install() {
local ASDF_YARN_DIR="$(mktemp -d -t asdf-yarn-XXXXXXX)"
local ASDF_YARN_DIR
ASDF_YARN_DIR="$(mktemp -d -t asdf-yarn-XXXXXXX)"

(
cd "${ASDF_YARN_DIR}"
Expand All @@ -91,7 +93,7 @@ asdf_yarn_v2_plus_install() {
wget -O yarn "https://repo.yarnpkg.com/${ASDF_INSTALL_VERSION}/packages/yarnpkg-cli/bin/yarn.js"
else
if [ -x "$(which curl)" ]; then
curl -sSL -o yarn "https://repo.yarnpkg.com/${ASDF_INSTALL_VERSION}/packages/yarnpkg-cli/bin/yarn.js"
curl -sSL -o yarn "https://repo.yarnpkg.com/${ASDF_INSTALL_VERSION}/packages/yarnpkg-cli/bin/yarn.js"
fi
fi
)
Expand All @@ -110,8 +112,9 @@ asdf_yarn_v2_plus_install() {
mv "${ASDF_YARN_DIR}/yarn" "${ASDF_INSTALL_PATH}/bin/yarn"
}

asdf_yarn_install(){
local MAJOR_VERSION="$(printf %.1s $ASDF_INSTALL_VERSION)"
asdf_yarn_install() {
local MAJOR_VERSION
MAJOR_VERSION=$(printf %.1s "$ASDF_INSTALL_VERSION")
if [ "$MAJOR_VERSION" = "1" ]; then
asdf_yarn_v1_install
else
Expand All @@ -122,7 +125,7 @@ asdf_yarn_install(){
[ "${ASDF_INSTALL_TYPE}" == 'ref' ] && asdf_yarn_fail "This plugin does not support installing by ref."
[ -z "${ASDF_INSTALL_VERSION}" ] && asdf_yarn_fail "Unspecified install version."
[ -z "${ASDF_INSTALL_PATH}" ] && asdf_yarn_fail "No installation directory was provided. Are you running this command via asdf? Try running 'asdf install yarn <version>'"
[ -x "$(which wget)" -o -x "$(which curl)" ] || asdf_yarn_fail "Missing one of either of the following dependencies: wget, curl"
[ -x "$(which tar)" -a -x "$(which gpg)" ] || asdf_yarn_fail "Missing one or more of the following dependencies: tar, gpg"
[ -x "$(which wget)" ] || [ -x "$(which curl)" ] || asdf_yarn_fail "Missing one of either of the following dependencies: wget, curl"
{ [ -x "$(which tar)" ] && [ -x "$(which gpg)" ]; } || asdf_yarn_fail "Missing one or more of the following dependencies: tar, gpg"

asdf_yarn_install $*
asdf_yarn_install "$@"
22 changes: 11 additions & 11 deletions bin/list-all
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n'

VERSIONS_CLASSIC="$(git ls-remote --refs --tags "https://github.com/yarnpkg/yarn.git" \
| sed -E 's|^.+refs/tags/||g' \
| grep -E '^v' \
| sort --version-sort \
| sed -E 's|^v||g' \
| grep -Ev '^0\.' \
| xargs)"
VERSIONS_CLASSIC="$(git ls-remote --refs --tags "https://github.com/yarnpkg/yarn.git" |
sed -E 's|^.+refs/tags/||g' |
grep -E '^v' |
sort --version-sort |
sed -E 's|^v||g' |
grep -Ev '^0\.' |
xargs)"

VERSIONS_BERRY="$(git ls-remote --refs --tags "https://github.com/yarnpkg/berry.git" \
| grep '@yarnpkg/cli' \
| sed -E 's|^.+refs/tags/@yarnpkg/cli/||g' \
| xargs)"
VERSIONS_BERRY="$(git ls-remote --refs --tags "https://github.com/yarnpkg/berry.git" |
grep '@yarnpkg/cli' |
sed -E 's|^.+refs/tags/@yarnpkg/cli/||g' |
xargs)"

echo "$VERSIONS_CLASSIC $VERSIONS_BERRY"
2 changes: 1 addition & 1 deletion bin/uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ asdf_yarn_uninstall() {

[ -z "${ASDF_INSTALL_PATH}" ] && asdf_yarn_fail "No installation directory was provided. Are you running this command via asdf? Try running 'asdf uninstall yarn <version>'"

asdf_yarn_uninstall $*
asdf_yarn_uninstall "$@"

0 comments on commit 872c297

Please sign in to comment.