refactor(script): Reuse the same pkg name separator in a var (#1)
This commit is contained in:
parent
c9fcdb5b29
commit
776480a9a3
@ -120,7 +120,7 @@ function write_pkg_list_oneline () {
|
|||||||
if [[ "${severity}" == 'imp' ]]; then
|
if [[ "${severity}" == 'imp' ]]; then
|
||||||
for pkg in "${important_pkgs_in_transaction[@]}"; do
|
for pkg in "${important_pkgs_in_transaction[@]}"; do
|
||||||
if [[ "${unabridged_pkg_list_oneline}" ]]; then
|
if [[ "${unabridged_pkg_list_oneline}" ]]; then
|
||||||
unabridged_pkg_list_oneline="${unabridged_pkg_list_oneline}"','"${pkg}"
|
unabridged_pkg_list_oneline="${unabridged_pkg_list_oneline}${pkg_separator}${pkg}"
|
||||||
else
|
else
|
||||||
unabridged_pkg_list_oneline="${pkg}"
|
unabridged_pkg_list_oneline="${pkg}"
|
||||||
fi
|
fi
|
||||||
@ -129,7 +129,7 @@ function write_pkg_list_oneline () {
|
|||||||
if [[ "${#trivial_pkgs_in_transaction[@]}" -ge '1' ]]; then
|
if [[ "${#trivial_pkgs_in_transaction[@]}" -ge '1' ]]; then
|
||||||
for pkg in "${trivial_pkgs_in_transaction[@]}"; do
|
for pkg in "${trivial_pkgs_in_transaction[@]}"; do
|
||||||
if [[ "${unabridged_pkg_list_oneline}" ]]; then
|
if [[ "${unabridged_pkg_list_oneline}" ]]; then
|
||||||
unabridged_pkg_list_oneline="${unabridged_pkg_list_oneline}"','"${pkg}"
|
unabridged_pkg_list_oneline="${unabridged_pkg_list_oneline}${pkg_separator}${pkg}"
|
||||||
else
|
else
|
||||||
unabridged_pkg_list_oneline="${pkg}"
|
unabridged_pkg_list_oneline="${pkg}"
|
||||||
fi
|
fi
|
||||||
@ -182,8 +182,8 @@ function trim_pkg_list_oneline () {
|
|||||||
local shorter_pkg_list
|
local shorter_pkg_list
|
||||||
shorter_pkg_list="${unabridged_pkg_list_oneline}"
|
shorter_pkg_list="${unabridged_pkg_list_oneline}"
|
||||||
while [[ "${#shorter_pkg_list}" -gt "${pkgs_list_max_length}" ]]; do
|
while [[ "${#shorter_pkg_list}" -gt "${pkgs_list_max_length}" ]]; do
|
||||||
shorter_pkg_list="${shorter_pkg_list%,*}"
|
shorter_pkg_list="${shorter_pkg_list%${pkg_separator}*}"
|
||||||
if ! grep -Piq ',' <<<"${shorter_pkg_list}"; then
|
if ! grep -Piq "${pkg_separator}" <<<"${shorter_pkg_list}"; then
|
||||||
# Only one package remains in package list, no need to continue
|
# Only one package remains in package list, no need to continue
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user