mirror of
https://github.com/go-task/task.git
synced 2025-08-10 22:42:19 +02:00
docs: small adjustment for #1220
This commit is contained in:
@@ -128,7 +128,7 @@ There are some special variables that is available on the templating system:
|
|||||||
| `CHECKSUM` | The checksum of the files listed in `sources`. Only available within the `status` prop and if method is set to `checksum`. |
|
| `CHECKSUM` | The checksum of the files listed in `sources`. Only available within the `status` prop and if method is set to `checksum`. |
|
||||||
| `TIMESTAMP` | The date object of the greatest timestamp of the files listed in `sources`. Only available within the `status` prop and if method is set to `timestamp`. |
|
| `TIMESTAMP` | The date object of the greatest timestamp of the files listed in `sources`. Only available within the `status` prop and if method is set to `timestamp`. |
|
||||||
| `TASK_VERSION` | The current version of task. |
|
| `TASK_VERSION` | The current version of task. |
|
||||||
| `ITEM` | The value of the current iteration when using the `for` property. |
|
| `ITEM` | The value of the current iteration when using the `for` property. Can be changed to a different variable name using `as:`. |
|
||||||
|
|
||||||
## ENV
|
## ENV
|
||||||
|
|
||||||
|
@@ -1043,7 +1043,9 @@ match that glob.
|
|||||||
|
|
||||||
Source paths will always be returned as paths relative to the task directory. If
|
Source paths will always be returned as paths relative to the task directory. If
|
||||||
you need to convert this to an absolute path, you can use the built-in
|
you need to convert this to an absolute path, you can use the built-in
|
||||||
`joinPath` function:
|
`joinPath` function.
|
||||||
|
There are some [special variables](/api/#special-variables) that you may find
|
||||||
|
useful for this.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '3'
|
version: '3'
|
||||||
@@ -1073,10 +1075,9 @@ version: '3'
|
|||||||
tasks:
|
tasks:
|
||||||
default:
|
default:
|
||||||
vars:
|
vars:
|
||||||
my_var: foo.txt bar.txt
|
MY_VAR: foo.txt bar.txt
|
||||||
cmds:
|
cmds:
|
||||||
- for:
|
- for: { var: MY_VAR }
|
||||||
var: my_var
|
|
||||||
cmd: cat {{.ITEM}}
|
cmd: cat {{.ITEM}}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -1089,11 +1090,9 @@ version: '3'
|
|||||||
tasks:
|
tasks:
|
||||||
default:
|
default:
|
||||||
vars:
|
vars:
|
||||||
my_var: foo.txt,bar.txt
|
MY_VAR: foo.txt,bar.txt
|
||||||
cmds:
|
cmds:
|
||||||
- for:
|
- for: { var: MY_VAR, split: ',' }
|
||||||
var: my_var
|
|
||||||
split: ','
|
|
||||||
cmd: cat {{.ITEM}}
|
cmd: cat {{.ITEM}}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -1105,11 +1104,10 @@ version: '3'
|
|||||||
tasks:
|
tasks:
|
||||||
default:
|
default:
|
||||||
vars:
|
vars:
|
||||||
my_var:
|
MY_VAR:
|
||||||
sh: find -type f -name '*.txt'
|
sh: find -type f -name '*.txt'
|
||||||
cmds:
|
cmds:
|
||||||
- for:
|
- for: { var: MY_VAR }
|
||||||
var: my_var
|
|
||||||
cmd: cat {{.ITEM}}
|
cmd: cat {{.ITEM}}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -1124,11 +1122,9 @@ version: '3'
|
|||||||
tasks:
|
tasks:
|
||||||
default:
|
default:
|
||||||
vars:
|
vars:
|
||||||
my_var: foo.txt bar.txt
|
MY_VAR: foo.txt bar.txt
|
||||||
cmds:
|
cmds:
|
||||||
- for:
|
- for: { var: MY_VAR, as: FILE }
|
||||||
var: my_var
|
|
||||||
as: FILE
|
|
||||||
cmd: cat {{.FILE}}
|
cmd: cat {{.FILE}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user