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.
This commit is contained in:
Tyler Akins
2015-05-05 10:46:06 -05:00
parent 3516cdd631
commit 5dfb1cd96a
2 changed files with 47 additions and 5 deletions

16
demo/associative-arrays Executable file
View File

@@ -0,0 +1,16 @@
#!/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