Skip to content

Commit 7b536c7

Browse files
committed
cherrypick cleanup fix from 1.4 -> main; suppresses warnings about empty array
Signed-off-by: Nick Boldt <[email protected]>
1 parent 049ae7f commit 7b536c7

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

modules/dynamic-plugins/rhdh-supported-plugins.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Options:
2727
2828
Examples:
2929
30-
$0 -b release-1.3 --clean
30+
$0 -b release-1.4 --clean
3131
3232
EOF
3333
}
@@ -297,16 +297,24 @@ num_plugins+=(${#adoc1[@]})
297297

298298
rm -f "${0/.sh/.adoc2}"
299299
sorted=(); while IFS= read -rd '' key; do sorted+=( "$key" ); done < <(printf '%s\0' "${!adoc2[@]}" | sort -z)
300-
for key in "${sorted[@]}"; do
301-
echo -e "${adoc2[$key]}" >> "${0/.sh/.ref-rh-tech-preview-plugins}";
302-
echo -e "${csv[$key]}" >> "${0/.sh/.csv}"; done
300+
# shellcheck disable=SC2128
301+
if [[ $sorted ]] ;then
302+
for key in "${sorted[@]}"; do
303+
echo -e "${adoc2[$key]}" >> "${0/.sh/.ref-rh-tech-preview-plugins}";
304+
echo -e "${csv[$key]}" >> "${0/.sh/.csv}"
305+
done
306+
fi
303307
num_plugins+=(${#adoc2[@]})
304308

305309
rm -f "${0/.sh/.adoc3}"
306310
sorted=(); while IFS= read -rd '' key; do sorted+=( "$key" ); done < <(printf '%s\0' "${!adoc3[@]}" | sort -z)
307-
for key in "${sorted[@]}"; do
308-
echo -e "${adoc3[$key]}" >> "${0/.sh/.ref-community-plugins}";
309-
echo -e "${csv[$key]}" >> "${0/.sh/.csv}"; done
311+
# shellcheck disable=SC2128
312+
if [[ $sorted ]] ;then
313+
for key in "${sorted[@]}"; do
314+
echo -e "${adoc3[$key]}" >> "${0/.sh/.ref-community-plugins}";
315+
echo -e "${csv[$key]}" >> "${0/.sh/.csv}"
316+
done
317+
fi
310318
num_plugins+=(${#adoc3[@]})
311319

312320
# merge the content from the three .adocX files into the .template.adoc file, replacing the TABLE_CONTENT markers

0 commit comments

Comments
 (0)