decision
The decision: command conditionally selects one of multiple potential outcomes.
Syntax
start:
decision:
outcome/weekend:
if@bool: {{'now'|date('l') in ['Saturday','Sunday'] ? 'yes'}}
then:
return:
output: It is the weekend.
outcome/weekday:
then:
return:
output: It is a weekday.outcome:
A decision has multiple outcome: commands. The first matching outcome is used.
Each outcome must have a unique name.
An outcome with no if: key always matches, so a bare outcome at the end of a decision is the default – outcome/weekday: above. If no outcome matches and there's no default, none of the then: blocks run, execution continues with the next command, and nothing is logged.
An outcome: can also be used on its own, without a decision, to make a single sequence of commands conditional.
| Key | |
|---|---|
if@bool: |
This key should resolve to a yes or no value to determine whether this outcome is desirable. |
then: |
If this outcome matches, the commands to run. |