wcl eval
Evaluate a WCL document and print the fully resolved output.
Usage
wcl eval <file> [options]
Options
| Flag | Description |
|---|---|
--format <fmt> | Output format: json, yaml, or toml (default: json) |
--var KEY=VALUE | Set an external variable (may be repeated) |
Description
wcl eval runs the full evaluation pipeline and serializes the resulting document to the requested format. All macros are expanded, all expressions evaluated, all imports merged, and all partial blocks resolved before output is produced.
The output represents the final, fully-resolved state of the document — suitable for consumption by tools that do not understand WCL natively.
Examples
Evaluate and print as JSON (default):
wcl eval config.wcl
Evaluate and print as YAML:
wcl eval config.wcl --format yaml
Evaluate and print as TOML:
wcl eval config.wcl --format toml
Override variables:
wcl eval --var PORT=8080 --var DEBUG=true config.wcl
Pipe output to another tool:
wcl eval config.wcl | jq '.service'
Example Output
Given:
let base_port = 8000
service svc-api {
port = base_port + 80
host = "localhost"
}
Running wcl eval config.wcl produces:
{
"service": {
"svc-api": {
"port": 8080,
"host": "localhost"
}
}
}