From c8015efaa78305918ee926bc686c9cc59d7b932b Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Fri, 12 Jun 2020 11:31:34 +0100 Subject: [PATCH] runtime: Refector collect script Add `start_section()` and `end_section()` functions to the data collection script to allow new unfoldable sections to be created. Redefine `show_header()` and `show_footer()` to use the new functions. Signed-off-by: James O. D. Hunt --- src/runtime/data/kata-collect-data.sh.in | 51 ++++++++++++++++-------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/src/runtime/data/kata-collect-data.sh.in b/src/runtime/data/kata-collect-data.sh.in index 3d5f05b123..c4c737d43f 100644 --- a/src/runtime/data/kata-collect-data.sh.in +++ b/src/runtime/data/kata-collect-data.sh.in @@ -132,6 +132,40 @@ separator() echo -e '\n---\n' } +# Create an unfoldable section. +# +# Note: end_section() must be called to terminate the fold. +start_section() +{ + local title="$1" + + cat < +${title} +

+ +EOT +} + +end_section() +{ + cat < + +EOT +} + +show_header() +{ + start_section "Show $script_name details" +} + +show_footer() +{ + end_section +} + have_cmd() { local cmd="$1" @@ -703,23 +737,6 @@ read_osbuilder_file() cat "$file" } -show_header() -{ - cat < -

Show $script_name details -

-EOT -} - -show_footer() -{ - cat < - -EOT -} - show_details() { show_header