Wildcard Arguments¶
Normally you can pass arguments to a command in Taskfile, but sometimes you may want to pass multiple arguments at once. In such cases, you can use wildcard arguments.
The arguments are stored in .MATCH variable.
Taskfile.yaml
version: '3'
tasks:
service:*:*:
vars:
SERVICE_NAME: "{{index .MATCH 0}}"
REPLICAS: "{{index .MATCH 1}}"
cmds:
- 'echo Service Name: {{.SERVICE_NAME}}'
- 'echo Replicas: {{.REPLICAS}}'
service:*:
vars:
SERVICE_NAME: "{{index .MATCH 0}}"
cmds:
- 'echo Service Name: {{.SERVICE_NAME}}'