More bugfixes and shellcheck tweaks

This commit is contained in:
Tyler Akins
2023-04-10 11:39:47 -05:00
parent 7604ce3054
commit 3a58ee390e
6 changed files with 47 additions and 20 deletions

View File

@@ -3,7 +3,7 @@
cd "$(dirname "$0")" # Go to the script's directory
declare -A DATA
DATA=([one]=111 [two]=222)
export DATA=([one]=111 [two]=222)
. ../mo
cat <<EOF | mo

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bash
#
# This embeds a template in the script without using strange `cat` syntax.
# shellcheck disable=SC1083 disable=SC1010 disable=SC1054 disable=SC1073 disable=SC1072 disable=SC1056 disable=SC1009
cd "$(dirname "$0")" # Go to the script's directory

View File

@@ -10,20 +10,22 @@ export ARRAY=( AAA BBB CCC )
# Include an external template
INCLUDE() {
cat "$MO_FUNCTION_ARGS"
# shellcheck disable=SC2031
cat "${MO_FUNCTION_ARGS[0]}"
}
# Print section title
TITLE() {
echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
echo "$MO_FUNCTION_ARGS"
# shellcheck disable=SC2031
echo "${MO_FUNCTION_ARGS[0]}"
echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
}
cat <<EOF | mo -u
{{TITLE Part 1}}
{{TITLE 'Part 1'}}
{{INCLUDE function-args-part1}}
{{TITLE Part 2}}
{{TITLE 'Part 2'}}
{{INCLUDE function-args-part2}}
EOF