Skip to content

Instantly share code, notes, and snippets.

@rahulkj
Created April 5, 2018 11:37
Show Gist options
  • Save rahulkj/11767d6fb2909f6264de4df2813fce34 to your computer and use it in GitHub Desktop.
Save rahulkj/11767d6fb2909f6264de4df2813fce34 to your computer and use it in GitHub Desktop.
get_latest_release() {
DOWNLOAD_URL=$(curl --silent "https://api.github.com/repos/$1/releases/latest" | \
jq -r \
--arg flavor $2 '.assets[] | select(.name | contains($flavor)) | .browser_download_url')
echo $DOWNLOAD_URL
}
get_latest_release "cloudfoundry-incubator/credhub-cli" "linux"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment