Skip to content

Commit

Permalink
fix: Correctly returns releases from dotnet
Browse files Browse the repository at this point in the history
  • Loading branch information
hensou committed Apr 24, 2022
1 parent 392575c commit f3128d0
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions lib/utils.bash
Expand Up @@ -29,10 +29,40 @@ list_github_tags() {
sed 's/^v//' # NOTE: You might want to adapt this sed to remove non-version strings from tags
}

list_all_versions() {
list_github_tags

# taken from asdf-dotnet-core plugin
RELEASES_URI=https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json
FILE="releases.json"
KEY="latest-sdk"

download() {
curl -s $RELEASES_URI
}

match_key() {
grep -Eo '"'$1'": \".*\"'
}

sanitize() {
sed -e 's/"'$1'": \"//;s/\"//'
}

gnutac() {
if hash tac 2>/dev/null; then
tac "$@"
else
tail -r "$@"
fi
}

# end taken from asdf-dotnet-core plugin

list_all_versions() {
#TODO: remove this function call
#list | xargs -n1 echo_github_tags
echo $(download | match_key $FILE | sanitize $FILE | xargs curl -s | match_key $KEY | sanitize $KEY) | sed 's/ /\n/g'
}

download_installer() {
local downloader
downloader=$1
Expand Down

0 comments on commit f3128d0

Please sign in to comment.