Added Functions/Helpers to README

This commit is contained in:
Joseph Dalrymple 2023-04-04 19:01:40 -05:00
parent c28bffe708
commit b22baa9776

View File

@ -158,6 +158,37 @@ Output:
```
### Helpers / Function Arguments with
Function Arguments are not a part of the official Mustache implementation, and are more often associated with Handlebar's Helper functionality.
`mo` allows for passing strings to functions.
```handlebars
{{myfunc foo bar}}
```
For security reasons, this arguments are not immediately available to function calls without a flag.
#### with `--allow-function-arguments`
```bash
myfunc() {
# Outputs "foo, bar"
echo "$1, $2";
}
```
#### Using `$MO_FUNCTION_ARGS`
```bash
myfunc() {
# Outputs "foo, bar"
echo "${MO_FUNCTION_ARGS[0]}, ${MO_FUNCTION_ARGS[1]}";
}
```
Concessions
-----------