This Commented CUE demonstrates how to use dependencies to influence the order of execution of tasks in a workflow command.
package example
import (
"strings"
"tool/cli"
"tool/file"
)
command: doStuff: {
// The readFile task reads a greeting from a file.
readFile: file.Read & {
filename: "input.txt"
contents: string
}
// The echoGreeting task prints the greeting read by readFile.
echoGreeting: cli.Print & {
text: "We read: \(strings.TrimSpace(readFile.contents))"
}
// The thankUser task prints a message after both readFile and echoGreeting are finished.
thankUser: cli.Print & {
$after: [readFile, echoGreeting]
text: "Thank you"
}
}
Hello, world!
TERMINAL
$ cue cmd doStuff
We read: Hello, world!
Thank you
Related content
- How-to Guide: Using your first CUE workflow command – getting started with workflow commands
- Reference: cue help commands
- Reference: cue help cmd