...
1#IgnoreConcrete: true
2#InferTasks: true
3-- in.cue --
4import (
5 "strings"
6 "tool/cli"
7)
8
9#Input: INPUT={
10 kind: string
11 outKey: string | *"default"
12 if kind != "foo" {
13 outKey: INPUT.kind
14 }
15}
16inputs: f: #Input & { kind: "foo" }
17inputs: b: #Input & { kind: "bar" }
18
19outputs: [string]: string
20for _, input in inputs {
21 outputs: "\(input.outKey)": input.kind
22}
23
24root: print: cli.Print & {
25 text: strings.Join([for key, val in outputs { "key=\(key) val=\(val)" }], "\n")
26}
27-- out/run/errors --
28-- out/run/t0 --
29graph TD
30 t0("root.print [Ready]")
31
32-- out/run/t1 --
33graph TD
34 t0("root.print [Terminated]")
35
36-- out/run/t1/value --
37{
38 $id: "tool/cli.Print"
39 stdout: "foo"
40 text: """
41 key=default val=foo
42 key=bar val=bar
43 """
44}
45-- out/run/t1/stats --
46Leaks: 0
47Freed: 30
48Reused: 24
49Allocs: 6
50Retain: 1
51
52Unifications: 22
53Conjuncts: 56
54Disjuncts: 31
55-- out/run/stats/totals --
56Leaks: 0
57Freed: 30
58Reused: 24
59Allocs: 6
60Retain: 1
61
62Unifications: 22
63Conjuncts: 56
64Disjuncts: 31
View as plain text