mirror of
https://github.com/go-task/task.git
synced 2025-08-10 22:42:19 +02:00
fix: templates on task descriptions (#1343)
This commit is contained in:
committed by
GitHub
parent
dc77286282
commit
05755f3a52
5
task.go
5
task.go
@@ -469,13 +469,14 @@ func (e *Executor) GetTaskList(filters ...FilterFunc) ([]*taskfile.Task, error)
|
||||
|
||||
// Compile the list of tasks
|
||||
for i := range tasks {
|
||||
task := tasks[i]
|
||||
idx := i
|
||||
task := tasks[idx]
|
||||
g.Go(func() error {
|
||||
compiledTask, err := e.FastCompiledTask(taskfile.Call{Task: task.Task})
|
||||
if err == nil {
|
||||
task = compiledTask
|
||||
}
|
||||
task = compiledTask
|
||||
tasks[idx] = compiledTask
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
18
task_test.go
18
task_test.go
@@ -828,6 +828,24 @@ func TestListCanListDescOnly(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestListDescInterpolation(t *testing.T) {
|
||||
const dir = "testdata/list_desc_interpolation"
|
||||
|
||||
var buff bytes.Buffer
|
||||
e := task.Executor{
|
||||
Dir: dir,
|
||||
Stdout: &buff,
|
||||
Stderr: &buff,
|
||||
}
|
||||
|
||||
require.NoError(t, e.Setup())
|
||||
if _, err := e.ListTasks(task.ListOptions{ListOnlyTasksWithDescriptions: true}); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
assert.Contains(t, buff.String(), "bar")
|
||||
}
|
||||
|
||||
func TestStatusVariables(t *testing.T) {
|
||||
const dir = "testdata/status_vars"
|
||||
|
||||
|
8
testdata/list_desc_interpolation/Taskfile.yml
vendored
Normal file
8
testdata/list_desc_interpolation/Taskfile.yml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
foo: bar
|
||||
|
||||
tasks:
|
||||
foo:
|
||||
desc: "task has desc with {{ .foo }} var"
|
Reference in New Issue
Block a user