version: '3'

tasks:
  task-1:
    - echo 'task-1 ran {{.PARAM}}'

  task-2:
    - defer: { task: 'task-1', vars: { PARAM: 'successfully' } }
    - defer: { task: 'task-1', vars: { PARAM: 'successfully' }, silent: true }
    - defer: echo 'echo ran'
      silent: true
    - defer: echo 'failing' && exit 2
    - echo 'cmd ran'
    - exit 1

  parent:
    vars:
      VAR1: "value-from-parent"
    cmds:
      - defer:
          task: child
          vars:
            VAR1: 'task deferred {{.VAR1}}'
      - task: child
        vars:
          VAR1: 'task immediate {{.VAR1}}'
  child:
    cmds:
    - cmd: echo "child {{.VAR1}}"
