-
-
Notifications
You must be signed in to change notification settings - Fork 763
Closed
Description
Description
tasks:
do:*:
vars:
THING: "{{index .MATCH 0}}"
_FIRST_THING: "one"
_SECOND_THING: "two"
requires:
vars:
- name: THING
enum: [ first, second ]
cmds:
- echo "{{.THING}}" # first
- echo "._{{.THING | upper}}_THING" # ._FIRST_THING
- echo "{{"{{"}}._{{.THING | upper}}_THING{{"}}"}}" # {{._FIRST_THING}}
- echo "{{._{{.THING | upper}}_THING}}" # This does not work, should print "one" for `task do:first`
If I would run task do:first, it would be awesome to be able to use the variable THING to get to the parsing of {{._FIRST_THING}} and echo "one" in the last command.
I can get something similar to work when doing an extra call to force a second render, but it would be nice if this could be done in a more direct way.
tasks:
_do-through-loop:
requires:
vars: [OUTPUT]
cmds:
- echo "{{.OUTPUT}}"
do-through-loop:*:
vars:
THING: "{{index .MATCH 0}}"
requires:
vars:
- name: THING
enum: [ first, second ]
cmds:
- task: '_do-through-loop'
vars:
OUTPUT: '{{"{{"}}._{{.THING | upper}}_THING{{"}}"}}'
_FIRST_THING: "one"
_SECOND_THING: "two"
Here's me hoping that second example is not going to be recognised as a bug, and eventually be removed 🤞
Metadata
Metadata
Assignees
Labels
No labels