From 6be3ff6141807621036a35dda4dc0ad1e0c51917 Mon Sep 17 00:00:00 2001 From: Pete Davison Date: Tue, 27 Jun 2023 14:14:29 +0000 Subject: [PATCH] chore: sources instead of source --- docs/static/schema.json | 12 ++++++------ testdata/for/Taskfile.yml | 4 ++-- variables.go | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/static/schema.json b/docs/static/schema.json index 5641c035..70d49a28 100644 --- a/docs/static/schema.json +++ b/docs/static/schema.json @@ -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": { diff --git a/testdata/for/Taskfile.yml b/testdata/for/Taskfile.yml index 0693ed71..576f684d 100644 --- a/testdata/for/Taskfile.yml +++ b/testdata/for/Taskfile.yml @@ -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 diff --git a/variables.go b/variables.go index 5d80ebd4..d97a40b6 100644 --- a/variables.go +++ b/variables.go @@ -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