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 <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2020-06-12 11:31:34 +01:00
parent 46f2618340
commit c8015efaa7

View File

@ -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 <<EOT
<details>
<summary>${title}</summary>
<p>
EOT
}
end_section()
{
cat <<EOT
</p>
</details>
EOT
}
show_header()
{
start_section "Show <tt>$script_name</tt> details"
}
show_footer()
{
end_section
}
have_cmd()
{
local cmd="$1"
@ -703,23 +737,6 @@ read_osbuilder_file()
cat "$file"
}
show_header()
{
cat <<EOT
<details>
<summary>Show <tt>$script_name</tt> details</summary>
<p>
EOT
}
show_footer()
{
cat <<EOT
</p>
</details>
EOT
}
show_details()
{
show_header