Description
How to reproduce:
-
Visit the documentation of variables.
-
Copy and paste the example in it:
version: 3
tasks:
foo:
vars:
STRING: 'Hello, World!'
BOOL: true
INT: 42
FLOAT: 3.14
ARRAY: [1, 2, 3]
MAP:
map: {A: 1, B: 2, C: 3}
cmds:
- 'echo {{.STRING}}' # Hello, World!
- 'echo {{.BOOL}}' # true
- 'echo {{.INT}}' # 42
- 'echo {{.FLOAT}}' # 3.14
- 'echo {{.ARRAY}}' # [1 2 3]
- 'echo {{.ARRAY.0}}' # 1
- 'echo {{.MAP}}' # map[A:1 B:2 C:3]
- 'echo {{.MAP.A}}' # 1
-
Execute task foo command.
-
It gives syntax error:
template: :1: unexpected ".0" in operand
The cause is this line:
- 'echo {{.ARRAY.0}}' # 1
Maybe we should use index function instead (i.e. index .ARRAY 0)?
Or is there any more concise syntax supported?
Version
3.43.2
Operating system
macOS
Experiments Enabled
No response
Example Taskfile
version: 3
tasks:
foo:
vars:
STRING: 'Hello, World!'
BOOL: true
INT: 42
FLOAT: 3.14
ARRAY: [1, 2, 3]
MAP:
map: {A: 1, B: 2, C: 3}
cmds:
- 'echo {{.STRING}}' # Hello, World!
- 'echo {{.BOOL}}' # true
- 'echo {{.INT}}' # 42
- 'echo {{.FLOAT}}' # 3.14
- 'echo {{.ARRAY}}' # [1 2 3]
- 'echo {{.ARRAY.0}}' # 1
- 'echo {{.MAP}}' # map[A:1 B:2 C:3]
- 'echo {{.MAP.A}}' # 1
Description
How to reproduce:
Visit the documentation of variables.
Copy and paste the example in it:
Execute
task foocommand.It gives syntax error:
The cause is this line:
Maybe we should use
indexfunction instead (i.e.index .ARRAY 0)?Or is there any more concise syntax supported?
Version
3.43.2
Operating system
macOS
Experiments Enabled
No response
Example Taskfile