mo/demo/associative-arrays
Tyler Akins 5dfb1cd96a Better associative array handling
Bug:  Did not properly detect the length of an array in mustache-test
because I neglected to use `[@]` after the array name.  This closes
issue #6.

Feature:  Made {{ARRAY_NAME}} implode array values with commas.

Feature:  Added an associative array demo script.
2015-05-05 10:46:06 -05:00

17 lines
225 B
Bash
Executable File

#!/bin/bash
declare -A DATA
DATA=([one]=111 [two]=222)
cat <<EOF | . ~/bin/mo
Accessing data directly:
DATA: {{DATA}}
One: {{DATA.one}}
Two: {{DATA.two}}
Things in DATA:
{{#DATA}}
Item: {{.}}
{{/DATA}}
EOF