summaryrefslogtreecommitdiff
path: root/utils/installer/install_stylua.sh
diff options
context:
space:
mode:
authorchristianchiarulli <[email protected]>2021-08-29 14:17:32 -0400
committerchristianchiarulli <[email protected]>2021-08-29 14:17:32 -0400
commited5559d259e38a78796a7d81421f02ba6dafac4b (patch)
treeafa9c00c017382bac547265a8a1e16b9770a07eb /utils/installer/install_stylua.sh
parente7b6d3b6f5982ea1042ffd499a7b85c18f0b782e (diff)
parentc7a5122fe2c14dba0f28f1c077f838f957884afc (diff)
Merge branch 'rolling' of github.com:ChristianChiarulli/LunarVim
Diffstat (limited to 'utils/installer/install_stylua.sh')
-rwxr-xr-xutils/installer/install_stylua.sh76
1 files changed, 38 insertions, 38 deletions
diff --git a/utils/installer/install_stylua.sh b/utils/installer/install_stylua.sh
index 2a33de7e..963416ea 100755
--- a/utils/installer/install_stylua.sh
+++ b/utils/installer/install_stylua.sh
@@ -11,53 +11,53 @@ declare -r FILENAME="stylua-$RELEASE-$OS"
declare -a __deps=("curl" "unzip")
function check_deps() {
- for dep in "${__deps[@]}"; do
- if ! command -v "$dep" >/dev/null; then
- echo "Missing depdendecy!"
- echo "The \"$dep\" command was not found!. Please install and try again."
- fi
- done
+ for dep in "${__deps[@]}"; do
+ if ! command -v "$dep" >/dev/null; then
+ echo "Missing depdendecy!"
+ echo "The \"$dep\" command was not found!. Please install and try again."
+ fi
+ done
}
function download_stylua() {
- local DOWNLOAD_DIR
- local URL="https://github.com/JohnnyMorganz/StyLua/releases/download/v$RELEASE/$FILENAME.zip"
-
- DOWNLOAD_DIR="$(mktemp -d)"
- echo "Initiating download for Stylua v$RELEASE"
- if ! curl --progress-bar --fail -L "$URL" -o "$DOWNLOAD_DIR/$FILENAME.zip"; then
- echo "Download failed. Check that the release/filename are correct."
- exit 1
- fi
-
- echo "Installation in progress.."
- unzip -q "$DOWNLOAD_DIR/$FILENAME.zip" -d "$DOWNLOAD_DIR"
-
- if [ -f "$DOWNLOAD_DIR/stylua" ]; then
- mv "$DOWNLOAD_DIR/stylua" "$INSTALL_DIR/stylua"
- else
- mv "$DOWNLOAD_DIR/$FILENAME/stylua" "$INSTALL_DIR/."
- fi
-
- chmod u+x "$INSTALL_DIR/stylua"
+ local DOWNLOAD_DIR
+ local URL="https://github.com/JohnnyMorganz/StyLua/releases/download/v$RELEASE/$FILENAME.zip"
+
+ DOWNLOAD_DIR="$(mktemp -d)"
+ echo "Initiating download for Stylua v$RELEASE"
+ if ! curl --progress-bar --fail -L "$URL" -o "$DOWNLOAD_DIR/$FILENAME.zip"; then
+ echo "Download failed. Check that the release/filename are correct."
+ exit 1
+ fi
+
+ echo "Installation in progress.."
+ unzip -q "$DOWNLOAD_DIR/$FILENAME.zip" -d "$DOWNLOAD_DIR"
+
+ if [ -f "$DOWNLOAD_DIR/stylua" ]; then
+ mv "$DOWNLOAD_DIR/stylua" "$INSTALL_DIR/stylua"
+ else
+ mv "$DOWNLOAD_DIR/$FILENAME/stylua" "$INSTALL_DIR/."
+ fi
+
+ chmod u+x "$INSTALL_DIR/stylua"
}
function verify_install() {
- echo "Verifying installation.."
- local DOWNLOADED_VER
- DOWNLOADED_VER="$("$INSTALL_DIR/stylua" -V | awk '{ print $2 }')"
- if [ "$DOWNLOADED_VER" != "$RELEASE" ]; then
- echo "Mismatched version!"
- echo "Expected: v$RELEASE but got v$DOWNLOADED_VER"
- exit 1
- fi
- echo "Verification complete!"
+ echo "Verifying installation.."
+ local DOWNLOADED_VER
+ DOWNLOADED_VER="$("$INSTALL_DIR/stylua" -V | awk '{ print $2 }')"
+ if [ "$DOWNLOADED_VER" != "$RELEASE" ]; then
+ echo "Mismatched version!"
+ echo "Expected: v$RELEASE but got v$DOWNLOADED_VER"
+ exit 1
+ fi
+ echo "Verification complete!"
}
function main() {
- check_deps
- download_stylua
- verify_install
+ check_deps
+ download_stylua
+ verify_install
}
main "$@"