rcl evaluate¶
rcl evaluate [-f | --format <format>] [--] [<file>] [--output <outfile>]
Shorthands:
rcl eval
rcl e (uses default --format=rcl)
rcl je (sets --format=json)
rcl re (sets --format=raw)
Description¶
Read an RCL expression from the file <file>
, and evaluate it. Print the evaluated result to stdout. When <file>
is -
, read from stdin. When no file is specified, the input defaults to stdin.
Options¶
--banner <message>
¶
Prepend the banner message to the output. This can be useful to add a comment to a generated file to clarify that the file is generated. RCL implicitly adds a line break between the banner and the output.
-f
--format <format>
¶
Output in the given format. The following formats are supported:
- json
- Output pretty-printed JSON.
- raw
- If the document is a string, output the string itself. If the document is a list or set of strings, output each string on its own line.
- rcl
- Output pretty-printed RCL.
- toml
- Output TOML.
- yaml-stream
- If the document is a list, output every element as a JSON document, prefixed by the
---
YAML document separator. Top-level values other than lists are not valid for this format.
The default output format is rcl
. For the je
command shorthand, the default output format is json
.
--output-depfile <depfile>
¶
Write the names of the files that were loaded during evaluation in Makefile syntax to the file <depfile>
. This can be used by build systems to re-run rcl
when one of the inputs changes. See also the depfile section of the Ninja documentation. Because the depfile includes the name of the dependent file, this option can only be used in combination with --output
.
-o
--output <outfile>
¶
Write the output to the given file instead of stdout. When --directory
is set, the output path is relative to that directory. --color
does not apply when using --output
.
--sandbox <mode>
¶
Limit which files can be imported in import expressions. Two modes are available:
- workdir
- Only allow importing files inside the working directory, including subdirectories. For example, when
rcl
is executed in/home/user/exprs
, importing/home/user/exprs/a/b.rcl
is allowed, but importing/home/user/.config/private.rcl
is not. - unrestricted
- Grant unrestricted filesystem access, allow importing any file.
The default sandboxing mode is workdir.
-w
--width <width>
¶
Target width for pretty-printing, in columns. Must be an integer. Defaults to 80.