run shellfmt on all of extensions

This commit is contained in:
Ricardo Pardini
2022-10-08 13:17:42 +02:00
parent 85c8cbf15d
commit 6b28de15fe
8 changed files with 65 additions and 65 deletions

View File

@@ -4,24 +4,24 @@ function extension_metadata_ready__499_display_docs_generation_start_info() {
}
function extension_metadata_ready__docs_markdown() {
generate_markdown_docs_to_stdout >"${DEST}/"${LOG_SUBPATH}"/hooks.auto.docs.md"
generate_markdown_docs_to_stdout > "${DEST}/"${LOG_SUBPATH}"/hooks.auto.docs.md"
}
function extension_metadata_ready__docs_sample_extension() {
mkdir -p "${SRC}/userpatches/extensions"
generate_sample_extension_to_stdout >"${SRC}/userpatches/extensions/sample-extension.sh"
generate_sample_extension_to_stdout > "${SRC}/userpatches/extensions/sample-extension.sh"
}
## Internal functions
### Common stuff
function read_common_data() {
export HOOK_POINT_CALLS_COUNT=$(wc -l <"${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt")
export HOOK_POINT_CALLS_UNIQUE_COUNT=$(sort <"${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt" | uniq | wc -l)
export HOOK_POINT_CALLS_COUNT=$(wc -l < "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt")
export HOOK_POINT_CALLS_UNIQUE_COUNT=$(sort < "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt" | uniq | wc -l)
export HOOK_POINTS_WITH_MULTIPLE_CALLS=""
# Read the hook_points (main, official names) from the hook point ordering file.
export ALL_HOOK_POINT_CALLS=$(xargs echo -n <"${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt")
export ALL_HOOK_POINT_CALLS=$(xargs echo -n < "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt")
}
function loop_over_hook_points_and_call() {
@@ -32,7 +32,7 @@ function loop_over_hook_points_and_call() {
export HOOK_POINT="${one_hook_point}"
export MARKDOWN_HEAD="$(head -1 "${EXTENSION_MANAGER_TMP_DIR}/${one_hook_point}.orig.md")"
export MARKDOWN_BODY="$(tail -n +2 "${EXTENSION_MANAGER_TMP_DIR}/${one_hook_point}.orig.md")"
export COMPATIBILITY_NAMES="$(xargs echo -n <"${EXTENSION_MANAGER_TMP_DIR}/${one_hook_point}.compat")"
export COMPATIBILITY_NAMES="$(xargs echo -n < "${EXTENSION_MANAGER_TMP_DIR}/${one_hook_point}.compat")"
${callback}
done
}
@@ -40,29 +40,29 @@ function loop_over_hook_points_and_call() {
## Markdown stuff
function generate_markdown_docs_to_stdout() {
read_common_data
cat <<MASTER_HEADER
cat << MASTER_HEADER
# Armbian build system extensibility documentation
- This documentation is auto-generated.
MASTER_HEADER
[[ $HOOK_POINT_CALLS_COUNT -gt $HOOK_POINT_CALLS_UNIQUE_COUNT ]] && {
# Some hook points were called multiple times, determine which.
HOOK_POINTS_WITH_MULTIPLE_CALLS=$(comm -13 <(sort <"${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt" | uniq) <(sort <"${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt") | sort | uniq | xargs echo -n)
HOOK_POINTS_WITH_MULTIPLE_CALLS=$(comm -13 <(sort < "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt" | uniq) <(sort < "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt") | sort | uniq | xargs echo -n)
cat <<MULTIPLE_CALLS_WARNING
cat << MULTIPLE_CALLS_WARNING
- *Important:* The following hook points where called multiple times during the documentation generation. This can be indicative of a bug in the build system. Please check the sources for the invocation of the following hooks: \`${HOOK_POINTS_WITH_MULTIPLE_CALLS}\`.
MULTIPLE_CALLS_WARNING
}
cat <<PRE_HOOKS_HEADER
cat << PRE_HOOKS_HEADER
## Hooks
- Hooks are listed in the order they are called.
PRE_HOOKS_HEADER
loop_over_hook_points_and_call "generate_markdown_one_hook_point_to_stdout"
cat <<MASTER_FOOTER
cat << MASTER_FOOTER
------------------------------------------------------------------------------------------
MASTER_FOOTER
@@ -71,7 +71,7 @@ MASTER_FOOTER
function generate_markdown_one_hook_point_to_stdout() {
# Hook name in 3rd level title, first line of description in a blockquote.
# The rest in a normal block.
cat <<HOOK_DOCS
cat << HOOK_DOCS
### \`${one_hook_point}\`
> ${MARKDOWN_HEAD}
@@ -92,7 +92,7 @@ HOOK_DOCS
## Bash sample extension stuff
generate_sample_extension_to_stdout() {
read_common_data
cat <<HEADER
cat << HEADER
# Sample Armbian build system extension with all extension methods.
# This file is auto-generated from and by the build system itself.
# Please, always use the latest version of this file as a starting point for your own extensions.
@@ -114,7 +114,7 @@ generate_bash_sample_for_hook_point() {
local bonus=""
[[ "${HOOK_POINT_COUNTER}" == "1" ]] && bonus="$(echo -e "\n\texport PROGRESS_DISPLAY=verysilent # Example: export a variable. This one silences the built.")"
cat <<SAMPLE_BASH_CODE
cat << SAMPLE_BASH_CODE
${COMMENT_HEAD}
${COMMENT_BODY}
function ${HOOK_POINT}__be_more_awesome() {