2023-04-04 02:00:31 -05:00
|
|
|
#!/usr/bin/env bash
|
2019-08-08 10:36:44 +02:00
|
|
|
#
|
|
|
|
# This sources a simple script with the env. variables needed for the template.
|
|
|
|
|
|
|
|
cd "$(dirname "$0")" # Go to the script's directory
|
|
|
|
source ../mo
|
|
|
|
|
|
|
|
export NAME="Alex"
|
|
|
|
export ARRAY=( AAA BBB CCC )
|
|
|
|
|
|
|
|
# Include an external template
|
|
|
|
INCLUDE() {
|
2023-04-10 11:39:47 -05:00
|
|
|
# shellcheck disable=SC2031
|
|
|
|
cat "${MO_FUNCTION_ARGS[0]}"
|
2019-08-08 10:36:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Print section title
|
|
|
|
TITLE() {
|
|
|
|
echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
|
2023-04-10 11:39:47 -05:00
|
|
|
# shellcheck disable=SC2031
|
|
|
|
echo "${MO_FUNCTION_ARGS[0]}"
|
2019-08-08 10:36:44 +02:00
|
|
|
echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
|
|
|
|
}
|
|
|
|
|
|
|
|
cat <<EOF | mo -u
|
2023-04-10 11:39:47 -05:00
|
|
|
{{TITLE 'Part 1'}}
|
2023-05-07 21:18:00 -05:00
|
|
|
{{INCLUDE 'function-args-part1'}}
|
2019-08-08 10:36:44 +02:00
|
|
|
|
2023-04-10 11:39:47 -05:00
|
|
|
{{TITLE 'Part 2'}}
|
2023-05-07 21:18:00 -05:00
|
|
|
{{INCLUDE 'function-args-part2'}}
|
2019-08-08 10:36:44 +02:00
|
|
|
EOF
|