Browse Source

Add !expr to readme and concat/concat* functions

master
Adam Pippin 3 years ago
parent
commit
ce600dd8e7
  1. 41
      README.md

41
README.md

@ -237,9 +237,45 @@ Resources:
The true/false values can include maps/arrays/any other valid YAML.
#### !expr
Evaluate an expression and insert the result.
Expects a scalar representing an expression using the same notatation as !if (and
outlined below).
If the expression evaluates down to a single value, it will be inserted as a
scalar. If it evaluates down to multiple values, it will be inserted as an array.
Example:
```
cfnpp:
variables:
A: 1
B: 2
C: !expr 1 2 gt
Math:
IsALessThanB: !expr A B lt
AllMyFavouriteVariables: !expr A B
ValueOfC: !var C
```
Result:
```
Math:
IsALessThanB: True
AllMyFavouriteVariables:
- 1
- 2
ValueOfC: False
```
#### Expressions
Expressions are composed of space separated values and operators. Value components
Expressions are composed of space separated values and operators. Valid components
are:
* Numeric Literals: Any integer or float value.
@ -256,6 +292,9 @@ are:
- lte: less than or equal
- and: boolean and
- or: boolean or
* Function: Currently supported functions are:
- concat: Concatenate as strings two values off of the stack
- concat\*: Concatenate all values currently on the stack down to a single value.
## Usage

Loading…
Cancel
Save