Skip to content

Commit

Permalink
chore: sources instead of source
Browse files Browse the repository at this point in the history
  • Loading branch information
pd93 committed Jun 27, 2023
1 parent 2f39f65 commit e1e5a39
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions docs/static/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
"$ref": "#/definitions/3/for_list"
},
{
"$ref": "#/definitions/3/for_source"
"$ref": "#/definitions/3/for_attribute"
},
{
"$ref": "#/definitions/3/for_var"
Expand Down Expand Up @@ -342,19 +342,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": {
Expand Down
4 changes: 2 additions & 2 deletions testdata/for/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ tasks:
- foo.txt
- bar.txt
cmds:
- for: source
- for: sources
cmd: cat "{{.ITEM}}"

# Loop over the task's sources when globbed
loop-sources-glob:
sources:
- "*.txt"
cmds:
- for: source
- for: sources
cmd: cat "{{.ITEM}}"

# Loop over the contents of a variable
Expand Down
4 changes: 2 additions & 2 deletions variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,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
Expand Down

0 comments on commit e1e5a39

Please sign in to comment.