1
0
mirror of https://github.com/go-task/task.git synced 2025-06-15 00:15:10 +02:00

chore: sources instead of source

This commit is contained in:
Pete Davison
2023-06-27 14:14:29 +00:00
committed by Andrey Nering
parent 36565bbbd2
commit 6be3ff6141
3 changed files with 10 additions and 10 deletions

View File

@ -332,7 +332,7 @@
"$ref": "#/definitions/3/for_list" "$ref": "#/definitions/3/for_list"
}, },
{ {
"$ref": "#/definitions/3/for_source" "$ref": "#/definitions/3/for_attribute"
}, },
{ {
"$ref": "#/definitions/3/for_var" "$ref": "#/definitions/3/for_var"
@ -360,19 +360,19 @@
"required": ["for"] "required": ["for"]
}, },
"for_list": { "for_list": {
"description": "List of values to iterate over", "description": "A list of values to iterate over",
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} }
}, },
"for_source": { "for_attribute": {
"description": "List of values to iterate over", "description": "The task attribute to iterate over",
"type": "string", "type": "string",
"enum": ["source"] "enum": ["sources"]
}, },
"for_var": { "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", "type": "object",
"properties": { "properties": {
"var": { "var": {

View File

@ -13,7 +13,7 @@ tasks:
- foo.txt - foo.txt
- bar.txt - bar.txt
cmds: cmds:
- for: source - for: sources
cmd: cat "{{.ITEM}}" cmd: cat "{{.ITEM}}"
# Loop over the task's sources when globbed # Loop over the task's sources when globbed
@ -21,7 +21,7 @@ tasks:
sources: sources:
- "*.txt" - "*.txt"
cmds: cmds:
- for: source - for: sources
cmd: cat "{{.ITEM}}" cmd: cat "{{.ITEM}}"
# Loop over the contents of a variable # Loop over the contents of a variable

View File

@ -126,12 +126,12 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf
} }
if cmd.For != nil { if cmd.For != nil {
var list []string 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 { if cmd.For.List != nil && len(cmd.For.List) > 0 {
list = cmd.For.List list = cmd.For.List
} }
// Get the list from the task sources // 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) list, err = fingerprint.Globs(new.Dir, new.Sources)
if err != nil { if err != nil {
return nil, err return nil, err