The cue export
command evaluates an expression in the context of a particular
configuration and then emits the value of the expression encoded as concrete
data. The command fails with an error message if evaluation is unsuccessful, or
if the value of the evaluated expression is not concrete.
The default behavior is to evaluate the single CUE package in the current directory, and to emit its top-level configuration to the standard output stream of the command, encoded as JSON:
package example
import "math"
info: "Vector magnitude is \(vector._m)"
vector: #Vector & {
x: 1.1
y: 2 * 2
z: x + y
_m: math.Sqrt(x*x + y*y + z*z)
}
#Vector: ["x" | "y" | "z"]: number
$ cue export
{
"info": "Vector magnitude is 6.57419196555744",
"vector": {
"x": 1.1,
"y": 4,
"z": 5.1
}
}
The default behaviours of cue export
can be overriden using parameters to
control its inputs, output, and operation.
The command can read and process an arbitrary number of data and data-constraint inputs provided as CUE and other encodings; can format its output in JSON, YAML, CUE, or TOML; and can place that output in a named file.
To learn more, refer to:
- Concept Guide: Using the cue export command –
an in-depth guide to
cue export
- Reference: cue help export –
the built-in help text for the
cue export
command