-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs/howto: influence workflow command task order
Fixes cue-lang/docs-and-content#124. Preview-Path: /docs/howto/influence-workflow-command-task-order/ Signed-off-by: Paul Jolly <[email protected]> Change-Id: Iada6f005cc9ab4f5cd029a769efc268074a62b50 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1203072 TryBot-Result: CUEcueckoo <[email protected]>
- Loading branch information
1 parent
471ea8d
commit 4ec1883
Showing
4 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
content/docs/howto/influence-workflow-command-task-order/en.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: Influencing the order of tasks in a workflow command | ||
toc_hide: true | ||
authors: [myitcv] | ||
tags: [workflow command] | ||
--- | ||
|
||
This [Commented CUE]({{< relref "docs/howto/about-commented-cue-guides" >}}) | ||
demonstrates how to use dependencies to influence the order of execution of | ||
tasks in a workflow command. | ||
|
||
{{{with code "en" "cc"}}} | ||
#location top top bottom | ||
exec cue cmd doStuff | ||
cmp stdout out | ||
-- some_tool.cue -- | ||
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" | ||
} | ||
} | ||
-- input.txt -- | ||
Hello, world! | ||
-- out -- | ||
We read: Hello, world! | ||
Thank you | ||
{{{end}}} | ||
|
||
## Related content | ||
|
||
- {{<linkto/related/howto "use-your-first-cue-workflow-command" >}} | ||
-- getting started with workflow commands | ||
- {{<linkto/related/reference "command/cue-help-commands">}} | ||
- {{<linkto/related/reference "command/cue-help-cmd">}} |
18 changes: 18 additions & 0 deletions
18
content/docs/howto/influence-workflow-command-task-order/gen_cache.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package site | ||
{ | ||
content: { | ||
docs: { | ||
howto: { | ||
"influence-workflow-command-task-order": { | ||
page: { | ||
cache: { | ||
code: { | ||
cc: "Gjzsk+dVviHn1zJwNtQ6iigBQf3aT/y00aQnEfPSCUA=" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
content/docs/howto/influence-workflow-command-task-order/page.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package site | ||
|
||
content: docs: howto: "influence-workflow-command-task-order": page: _ |
56 changes: 56 additions & 0 deletions
56
hugo/content/en/docs/howto/influence-workflow-command-task-order/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: Influencing the order of tasks in a workflow command | ||
toc_hide: true | ||
authors: [myitcv] | ||
tags: [workflow command] | ||
--- | ||
|
||
This [Commented CUE]({{< relref "docs/howto/about-commented-cue-guides" >}}) | ||
demonstrates how to use dependencies to influence the order of execution of | ||
tasks in a workflow command. | ||
|
||
{{< code-tabs >}} | ||
{{< code-tab name="some_tool.cue" language="cue" area="top" >}} | ||
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" | ||
} | ||
} | ||
{{< /code-tab >}} | ||
{{< code-tab name="input.txt" language="txt" area="top" >}} | ||
Hello, world! | ||
{{< /code-tab >}} | ||
{{< code-tab name="TERMINAL" language="" area="bottom" type="terminal" codetocopy="Y3VlIGNtZCBkb1N0dWZm" >}} | ||
$ cue cmd doStuff | ||
We read: Hello, world! | ||
Thank you | ||
{{< /code-tab >}} | ||
{{< /code-tabs >}} | ||
|
||
## Related content | ||
|
||
- {{<linkto/related/howto "use-your-first-cue-workflow-command" >}} | ||
-- getting started with workflow commands | ||
- {{<linkto/related/reference "command/cue-help-commands">}} | ||
- {{<linkto/related/reference "command/cue-help-cmd">}} |