-
-
Notifications
You must be signed in to change notification settings - Fork 763
Closed
Labels
area: docsChanges related to documentation.Changes related to documentation.good first issueIssues that are good for first-time contributors to pick up.Issues that are good for first-time contributors to pick up.
Description
Description
How to reproduce:
-
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 foocommand. -
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}}' # 1Metadata
Metadata
Assignees
Labels
area: docsChanges related to documentation.Changes related to documentation.good first issueIssues that are good for first-time contributors to pick up.Issues that are good for first-time contributors to pick up.