Evaluate an expression
evaluate always evaluates an expression once and writes one formatted value.
Raw Expressif syntax is the default output format. Use --output json for a valid JSON root value, including scalars such as "Alice", 42, true, and null. --raw selects the default format explicitly and is equivalent to --output raw; the two selectors are mutually exclusive.
Structured results use compact, single-line formatting by default. Pass --output-style pretty to display each element on its own line with two spaces per nesting level:
expressif evaluate '{1, T(2, 3)}' --output-style pretty
Pretty output keeps configured value types inline when their complete compact form fits within the preferred line width. The defaults select tuples and 80 characters. A value that does not fit falls back to the normal multiline layout, and eligible descendants are considered independently. The same policy applies to raw and JSON output; in JSON, an eligible tuple is represented by an inline array. Use expressif config set preferred-line-width <width> and expressif config set inline-types <types> to change the policy.
Use --output-style compact to select the default behavior explicitly. --pretty and --compact are shortcuts for the corresponding styles. These shortcuts and --output-style are mutually exclusive.
Pretty output uses two spaces per nesting level by default. Select another space count from 0 to 8, or tabs, with --indent:
expressif evaluate '{1, T(2, 3)}' --pretty --indent 4
expressif evaluate '{1, T(2, 3)}' --pretty --indent tab
--indent requires pretty output. These style options also apply to JSON output.
What changes is the value supplied to that evaluation.
| Mode | How to select it | Input to the expression |
|---|---|---|
| Closed | Do not provide --input or --source. | No incoming value. |
| Explicit value | Provide --input or -i. | One parsed CLI value. |
| Complete source | Provide --source or -s. | One array containing all source rows. |
Evaluate a closed expression
A closed expression contains everything needed for its evaluation.
expressif evaluate "5 | add(3)"
The command writes only the result:
8
If the expression requires an incoming value, supply one with --input or use run for several values.
Evaluate one input value
expressif evaluate 'absolute | add(5)' --input -12
17
The value passed to --input uses Expressif literal syntax. Numbers, booleans, null, arrays, records, dates, temporal values, and text are supported. A simple unquoted scalar that is not another valid literal is treated as text when this is unambiguous.
Quote structured or punctuation-rich values for both Expressif and the host shell:
expressif evaluate 'count' --input '{1, 2, 3}'
--input can be supplied only once. To process several independent inputs, use run.
Evaluate a complete source
With --source, all rows are materialized into one array before evaluation.
expressif evaluate 'sum' --source numeric.csv --scalar
flowchart LR
A[Source rows] --> B[One array]
B --> C[evaluate once]
C --> D[One result]
--source and --input cannot be combined. --scalar requires --source and a tabular source with exactly one column.
CSV files are read as tabular data. Other file extensions are interpreted as strict UTF-8 Expressif source expressions; the source expression must be closed and return an enumerable value or IDataReader.
See Run expressions over input data for CSV profiles and for evaluating once per source row.
Read the expression from a file
Supply the expression inline or with --file/-f, but not both.
expressif evaluate --file ./expressions/transform.expr
Expression files are strict UTF-8, may span several lines, and cannot be empty or contain only whitespace. Relative paths are resolved from the current working directory.
Read the result
Successful output contains no Result: prefix, which makes it suitable for pipelines and command substitution. A null result is rendered as null.
Failures are written to standard error. The exit status distinguishes invalid expressions or inputs from failures that occur during evaluation; see Automation and exit codes.