mo/demo/function-args

32 lines
705 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
#
# 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 16:39:47 +00:00
# shellcheck disable=SC2031
cat "${MO_FUNCTION_ARGS[0]}"
}
# Print section title
TITLE() {
echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
2023-04-10 16:39:47 +00:00
# shellcheck disable=SC2031
echo "${MO_FUNCTION_ARGS[0]}"
echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
}
cat <<EOF | mo -u
2023-04-10 16:39:47 +00:00
{{TITLE 'Part 1'}}
2023-05-08 02:18:00 +00:00
{{INCLUDE 'function-args-part1'}}
2023-04-10 16:39:47 +00:00
{{TITLE 'Part 2'}}
2023-05-08 02:18:00 +00:00
{{INCLUDE 'function-args-part2'}}
EOF