refactor: scripts/download.sh

This commit is contained in:
Caleb Bassi 2019-02-07 03:06:55 -08:00
parent dd25fa5458
commit e2c26cd7ac
1 changed files with 3 additions and 4 deletions

View File

@ -8,6 +8,7 @@ function get_latest_release {
} }
function download { function download {
RELEASE=$(get_latest_release 'cjbassi/gotop')
ARCHIVE=gotop_${RELEASE}_${1}.tgz ARCHIVE=gotop_${RELEASE}_${1}.tgz
curl -LO https://github.com/cjbassi/gotop/releases/download/${RELEASE}/${ARCHIVE} curl -LO https://github.com/cjbassi/gotop/releases/download/${RELEASE}/${ARCHIVE}
tar xf ${ARCHIVE} tar xf ${ARCHIVE}
@ -16,8 +17,6 @@ function download {
function main { function main {
ARCH=$(uname -sm) ARCH=$(uname -sm)
RELEASE=$(get_latest_release 'cjbassi/gotop')
case "${ARCH}" in case "${ARCH}" in
# order matters # order matters
Darwin\ *64) download darwin_amd64 ;; Darwin\ *64) download darwin_amd64 ;;