-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug_tool.cue
35 lines (31 loc) · 931 Bytes
/
debug_tool.cue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"tool/cli"
"encoding/yaml"
"text/tabwriter"
)
_resources: timoni.apply.app
// The build command generates the Kubernetes manifests and prints the multi-docs YAML to stdout.
// Example 'cue cmd -t debug -t name=test -t namespace=test -t mv=1.0.0 -t kv=1.28.0 build'.
command: build: {
task: print: cli.Print & {
text: yaml.MarshalStream(_resources)
}
}
// The ls command prints a table with the Kubernetes resources kind, namespace, name and version.
// Example 'cue cmd -t debug -t name=test -t namespace=test -t mv=1.0.0 -t kv=1.28.0 ls'.
command: ls: {
task: print: cli.Print & {
text: tabwriter.Write([
"RESOURCE \tAPI VERSION",
for r in _resources {
if r.metadata.namespace == _|_ {
"\(r.kind)/\(r.metadata.name) \t\(r.apiVersion)"
}
if r.metadata.namespace != _|_ {
"\(r.kind)/\(r.metadata.namespace)/\(r.metadata.name) \t\(r.apiVersion)"
}
},
])
}
}