Skip to content

Commit

Permalink
fix: Fix sorting of versions
Browse files Browse the repository at this point in the history
Previously, 3.2-2.5.9 would have been put after 3.2-2.5.10
  • Loading branch information
ysthakur committed Jan 9, 2025
1 parent 04902d8 commit b4fd7b7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ fi

# todo sort by only Ammonite version, not Scala version
sort_versions() {
awk -F '-' '{ print $2 "-" $1 }' | # Flip it so Ammonite tag comes before Scala version
LC_ALL=C sort -t'-' -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n |
awk -F '-' '{ print $2 "-" $1 }' # Flip it back to normal
# Flip it so Ammonite tag comes before Scala version, and use - as the delimiter everywhere
awk -F '[-.]' '{ print $3 "-" $4 "-" $5 "-" $1 "-" $2 }' |
LC_ALL=C sort -t'-' -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n |
awk -F '-' '{ print $4 "." $5 "-" $1 "." $2 "." $3 }' # Flip it back to normal
}

# Make a query to the GitHub API
Expand Down

0 comments on commit b4fd7b7

Please sign in to comment.