version: '2'

vars:
  NESTED2: "{{.NESTED1}}-TaskfileVars"

tasks:
  default:
    deps: [hello]

  hello:
    cmds:
      - echo {{.FOO}} > foo.txt
      - echo {{.BAR}} > bar.txt
      - echo {{.BAZ}} > baz.txt
      - echo '{{.TMPL_FOO}}' > tmpl_foo.txt
      - echo '{{.TMPL_BAR}}' > tmpl_bar.txt
      - echo '{{.TMPL_FOO2}}' > tmpl_foo2.txt
      - echo '{{.TMPL_BAR2}}' > tmpl_bar2.txt
      - echo '{{.SHTMPL_FOO}}' > shtmpl_foo.txt
      - echo '{{.SHTMPL_FOO2}}' > shtmpl_foo2.txt
      - echo '{{.NESTEDTMPL_FOO}}' > nestedtmpl_foo.txt
      - echo '{{.NESTEDTMPL_FOO2}}' > nestedtmpl_foo2.txt
      - echo {{.FOO2}} > foo2.txt
      - echo {{.BAR2}} > bar2.txt
      - echo {{.BAZ2}} > baz2.txt
      - echo '{{.TMPL2_FOO}}' > tmpl2_foo.txt
      - echo '{{.TMPL2_BAR}}' > tmpl2_bar.txt
      - echo '{{.TMPL2_FOO2}}' > tmpl2_foo2.txt
      - echo '{{.TMPL2_BAR2}}' > tmpl2_bar2.txt
      - echo '{{.SHTMPL2_FOO}}' > shtmpl2_foo.txt
      - echo '{{.SHTMPL2_FOO2}}' > shtmpl2_foo2.txt
      - echo '{{.NESTEDTMPL2_FOO2}}' > nestedtmpl2_foo2.txt
      - echo {{.OVERRIDE}} > override.txt
      - echo '{{.NESTED3}}' > nested.txt
    vars:
      FOO: foo
      BAR: $echo bar
      BAZ:
        sh: echo baz
      TMPL_FOO: "{{.FOO}}"
      TMPL_BAR: "{{.BAR}}"
      TMPL_FOO2: "{{.FOO2}}"
      TMPL_BAR2: "{{.BAR2}}"
      SHTMPL_FOO:
        sh: "echo '{{.FOO}}'"
      SHTMPL_FOO2:
        sh: "echo '{{.FOO2}}'"
      NESTEDTMPL_FOO: "{{.TMPL_FOO}}"
      NESTEDTMPL_FOO2: "{{.TMPL2_FOO2}}"
      OVERRIDE: "bar"
      NESTED3: "{{.NESTED2}}-TaskVars"

  invalid-var-tmpl:
    vars:
      CHARS: "abcd"
      INVALID: "{{range .CHARS}}no end"
