Detect OS for Elm Format Download

This commit is contained in:
Joshua Stoutenburg 2016-08-26 10:50:55 -06:00
parent ecb6e88d14
commit 359ad21a08

View file

@ -1,23 +1,19 @@
#!/usr/bin/env bash
# choose file for system
# Example:
# bin/install-elm-format linux
# bin/install-elm-format mac
case $1 in
mac)
FILE=https://github.com/avh4/elm-format/releases/download/0.4.0-alpha/elm-format-0.17-0.4.0-alpha-mac-x64.tgz
;;
linux)
FILE=https://github.com/avh4/elm-format/releases/download/0.4.0-alpha/elm-format-0.17-0.4.0-alpha-linux-x64.tgz
;;
*)
echo "please specify operating system"
exit 1
esac
OS=$(
case $(uname) in
(Darwin*)
echo "mac";;
(Linux*)
echo "linux";;
(Windows*)
echo "windows";;
(*)
echo "linux";;
esac)
# download file into bin
curl -L $FILE | tar -xvzO > bin/elm-format
URL=https://github.com/avh4/elm-format/releases/download/0.4.0-alpha/elm-format-0.17-0.4.0-alpha-$OS-x64.tgz
curl -L $URL | tar -xvzO > bin/elm-format
# give user execute
chmod u+x bin/elm-format