Skip to content

Commit e075715

Browse files
rpardiniyury-deltsov
authored andcommitted
extensions/gen-sample-extension-docs: fix to output non-garbage
- bash variable scoping is a b...
1 parent 6512b5a commit e075715

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

extensions/gen-sample-extension-docs.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ function read_common_data() {
2929
function loop_over_hook_points_and_call() {
3030
local callback="$1"
3131
HOOK_POINT_COUNTER=0
32+
declare one_hook_point
3233
for one_hook_point in ${ALL_HOOK_POINT_CALLS}; do
33-
declare -g HOOK_POINT_COUNTER=$((HOOK_POINT_COUNTER + 1))
34-
declare -g HOOK_POINT="${one_hook_point}"
35-
declare -g MARKDOWN_HEAD="$(head -1 "${EXTENSION_MANAGER_TMP_DIR}/${one_hook_point}.orig.md")"
36-
declare -g MARKDOWN_BODY="$(tail -n +2 "${EXTENSION_MANAGER_TMP_DIR}/${one_hook_point}.orig.md")"
37-
declare -g COMPATIBILITY_NAMES="$(xargs echo -n < "${EXTENSION_MANAGER_TMP_DIR}/${one_hook_point}.compat")"
34+
declare HOOK_POINT_COUNTER=$((HOOK_POINT_COUNTER + 1))
35+
declare MARKDOWN_HEAD="$(head -1 "${EXTENSION_MANAGER_TMP_DIR}/${one_hook_point}.orig.md")"
36+
declare MARKDOWN_BODY="$(tail -n +2 "${EXTENSION_MANAGER_TMP_DIR}/${one_hook_point}.orig.md")"
37+
declare COMPATIBILITY_NAMES="$(xargs echo -n < "${EXTENSION_MANAGER_TMP_DIR}/${one_hook_point}.compat")"
3838
${callback}
3939
done
4040
}
@@ -117,9 +117,9 @@ generate_bash_sample_for_hook_point() {
117117
cat << SAMPLE_BASH_CODE
118118
${COMMENT_HEAD}
119119
${COMMENT_BODY}
120-
function ${HOOK_POINT}__be_more_awesome() {
121-
# @TODO: Please rename this function to reflect what it does, but preserve the "${HOOK_POINT}__" prefix.
122-
display_alert "Being awesome at \${HOOK_POINT}" "\${EXTENSION}" "info"
120+
function ${one_hook_point}__be_more_awesome() {
121+
# @TODO: Please rename this function to reflect what it does, but preserve the "${one_hook_point}__" prefix.
122+
display_alert "Being awesome at ${one_hook_point}" "\${EXTENSION}" "info"
123123
}
124124
125125
SAMPLE_BASH_CODE

0 commit comments

Comments
 (0)