mirror of
https://github.com/tests-always-included/mo.git
synced 2024-12-18 16:27:52 +00:00
Added Functions/Helpers to README
This commit is contained in:
parent
c28bffe708
commit
b22baa9776
31
README.md
31
README.md
@ -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
|
||||
-----------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user