summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorCaleb Bassi <calebjbassi@gmail.com>2019-02-07 03:06:55 -0800
committerCaleb Bassi <calebjbassi@gmail.com>2019-02-07 03:06:55 -0800
commite2c26cd7ac56d6c108ac6143460ea59511bd569e (patch)
treee626228015fe98ae7c6d9ce8cc8e78021e41c4b1 /scripts
parentdd25fa54587cdacfa8f16f422650a0fdccaced55 (diff)
refactor: scripts/download.sh
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/download.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/scripts/download.sh b/scripts/download.sh
index 049caae..a525b2a 100755
--- a/scripts/download.sh
+++ b/scripts/download.sh
@@ -3,11 +3,12 @@
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
function get_latest_release {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
- grep '"tag_name":' | # Get tag line
- sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
+ grep '"tag_name":' | # Get tag line
+ sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
function download {
+ RELEASE=$(get_latest_release 'cjbassi/gotop')
ARCHIVE=gotop_${RELEASE}_${1}.tgz
curl -LO https://github.com/cjbassi/gotop/releases/download/${RELEASE}/${ARCHIVE}
tar xf ${ARCHIVE}
@@ -16,8 +17,6 @@ function download {
function main {
ARCH=$(uname -sm)
- RELEASE=$(get_latest_release 'cjbassi/gotop')
-
case "${ARCH}" in
# order matters
Darwin\ *64) download darwin_amd64 ;;