diff --git a/bin/list-all b/bin/list-all index 943371e..b79a2be 100755 --- a/bin/list-all +++ b/bin/list-all @@ -8,4 +8,6 @@ plugin_dir=$(dirname "$(dirname "$current_script_path")") # shellcheck source=../lib/utils.bash source "${plugin_dir}/lib/utils.bash" -list_all_versions | sort_versions | xargs echo +# The releases response also includes all the assets, so we can just use that +# instead of querying the assets for each release separately +gh_query "releases" | get_versions | sort_versions | xargs echo diff --git a/lib/utils.bash b/lib/utils.bash index e3dd1d6..d8ac83f 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -49,9 +49,8 @@ get_versions() { # Given a tag, list its scala-ammonite versions list_assets() { - local tag release_id - tag="$1" - release_id=$(gh_query "releases/tags/$tag" | + local release_id + release_id=$(gh_query "releases/tags/$1" | grep -oE '"id": [0-9]+' | cut -d ':' -f 2 | sed -E "s/(^ +)|\"//g" | # Trim @@ -59,12 +58,6 @@ list_assets() { gh_query "releases/$release_id/assets" | get_versions } -list_all_versions() { - # The releases response also includes all the assets, so we can just use that - # instead of querying the assets for each release separately - gh_query "releases" | get_versions -} - download_release() { local version filename tag url version="$1"