Fix sorting when normalizing package list.

This commit is contained in:
awalsh128 2022-07-14 21:57:20 -07:00
parent 9a4f0f7d01
commit fa7091e9a8

3
lib.sh
View file

@ -5,7 +5,8 @@ function normalize_package_list {
local stripped=$(echo "${1}" | sed 's/,//g') local stripped=$(echo "${1}" | sed 's/,//g')
# Remove extraneous spaces at the middle, beginning, and end. # Remove extraneous spaces at the middle, beginning, and end.
local trimmed="$(echo "${stripped}" | sed 's/\s\+/ /g; s/^\s\+//g; s/\s\+$//g')" local trimmed="$(echo "${stripped}" | sed 's/\s\+/ /g; s/^\s\+//g; s/\s\+$//g')"
echo "${trimmed}" | sort local sorted="$(echo ${trimmed} | tr ' ' '\n' | sort | tr '\n' ' ')"
echo "${sorted}"
} }
# Split fully qualified package into name and version # Split fully qualified package into name and version