Remove commas, and block scalar folded backslashes #84

This commit is contained in:
awalsh128 2023-02-04 21:08:45 -08:00
parent 5b6c3ab114
commit 270eae5fc9

7
lib.sh
View file

@ -118,14 +118,15 @@ function log_err { >&2 echo "$(date +%H:%M:%S)" "${@}"; }
function log_empty_line { echo ""; } function log_empty_line { echo ""; }
############################################################################### ###############################################################################
# Sorts given packages by name and split on commas. # Sorts given packages by name and split on commas and/or spaces.
# Arguments: # Arguments:
# The comma delimited list of packages. # The comma and/or space delimited list of packages.
# Returns: # Returns:
# Sorted list of space delimited packages. # Sorted list of space delimited packages.
############################################################################### ###############################################################################
function normalize_package_list { function normalize_package_list {
local stripped=$(echo "${1}" | sed 's/,//g') # Remove commas, and block scalar folded backslashes.
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="$(\ local trimmed="$(\
echo "${stripped}" \ echo "${stripped}" \