cli: allow setting the release to get in cli/get.sh (#4348)

This commit is contained in:
Darío Javier Cravero 2020-06-25 17:56:53 +02:00 committed by GitHub
parent 6d0518bc72
commit f6d111ccd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,10 +31,12 @@ if [ "$?" = "1" ]; then
die "You need to install curl to use this script."
fi
log "Getting latest version..."
release=${1:-latest}
log "Getting $release version..."
# adapted from https://github.com/openfaas/faas-cli/blob/master/get.sh
version=$(curl -s -f -H 'Content-Type: text/plain' https://releases.hasura.io/graphql-engine?agent=cli-get.sh)
version=`echo $(curl -s -f -H 'Content-Type: application/json' https://releases.hasura.io/graphql-engine?agent=cli-get.sh) | sed -n -e "s/^.*\"$release\":\"\([^\",}]*\)\".*$/\1/p"`
if [ ! $version ]; then
log "${YELLOW}"
log "Failed while attempting to install hasura graphql-engine cli. Please manually install:"
@ -138,4 +140,4 @@ if ! $(echo "$PATH" | grep -q "$INSTALL_PATH"); then
log
log "${YELLOW}$INSTALL_PATH not found in \$PATH, you might need to add it${NC}"
log
fi
fi