mirror of
https://github.com/go-task/task.git
synced 2025-06-04 23:38:05 +02:00
chore: sources instead of source
This commit is contained in:
parent
36565bbbd2
commit
6be3ff6141
12
docs/static/schema.json
vendored
12
docs/static/schema.json
vendored
@ -332,7 +332,7 @@
|
||||
"$ref": "#/definitions/3/for_list"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/3/for_source"
|
||||
"$ref": "#/definitions/3/for_attribute"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/3/for_var"
|
||||
@ -360,19 +360,19 @@
|
||||
"required": ["for"]
|
||||
},
|
||||
"for_list": {
|
||||
"description": "List of values to iterate over",
|
||||
"description": "A list of values to iterate over",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"for_source": {
|
||||
"description": "List of values to iterate over",
|
||||
"for_attribute": {
|
||||
"description": "The task attribute to iterate over",
|
||||
"type": "string",
|
||||
"enum": ["source"]
|
||||
"enum": ["sources"]
|
||||
},
|
||||
"for_var": {
|
||||
"description": "List of values to iterate over",
|
||||
"description": "Which variables to iterate over. The variable will be split using any whitespace character by default. This can be changed by using the `split` attribute.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"var": {
|
||||
|
4
testdata/for/Taskfile.yml
vendored
4
testdata/for/Taskfile.yml
vendored
@ -13,7 +13,7 @@ tasks:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
cmds:
|
||||
- for: source
|
||||
- for: sources
|
||||
cmd: cat "{{.ITEM}}"
|
||||
|
||||
# Loop over the task's sources when globbed
|
||||
@ -21,7 +21,7 @@ tasks:
|
||||
sources:
|
||||
- "*.txt"
|
||||
cmds:
|
||||
- for: source
|
||||
- for: sources
|
||||
cmd: cat "{{.ITEM}}"
|
||||
|
||||
# Loop over the contents of a variable
|
||||
|
@ -126,12 +126,12 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf
|
||||
}
|
||||
if cmd.For != nil {
|
||||
var list []string
|
||||
// Get the list from the explicit forh list
|
||||
// Get the list from the explicit for list
|
||||
if cmd.For.List != nil && len(cmd.For.List) > 0 {
|
||||
list = cmd.For.List
|
||||
}
|
||||
// Get the list from the task sources
|
||||
if cmd.For.From == "source" {
|
||||
if cmd.For.From == "sources" {
|
||||
list, err = fingerprint.Globs(new.Dir, new.Sources)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
x
Reference in New Issue
Block a user