A Rust implementation of the Jsonnet language. Currently, it targets Jsonnet version 0.20.
This project provides three crates:
- rsjsonnet: a command line program with an interface similar to the official implementation.
- rsjsonnet-lang: a library that provides parsing and evaluation of Jsonnet programs.
- rsjsonnet-front: a library built on top of rsjsonnet-lang and provides easy source loading and error printing.
You can download binaries of the command line for Linux and Windows from the GitHub releases page.
If you have a Rust toolchain installed on your system, you can build the latest version with:
cargo install --locked rsjsonnet
rsjsonnet provides a command line interface similar to the one of the official implementation.
Usage: rsjsonnet [OPTIONS] <filename>
Arguments:
<filename>
Options:
-e, --exec Treat filename as code
-J, --jpath <dir> Specify an additional library search dir (right-most wins)
-o, --output-file <file> Write to the output file rather than stdout
-m, --multi <dir> Write multiple files to the directory, list files on stdout
-y, --yaml-stream Write output as a YAML stream of JSON documents
-S, --string Expect a string, manifest as plain text
-s, --max-stack <n> Number of allowed stack frames
-t, --max-trace <n> Max length of stack trace before cropping
-V, --ext-str <var=[val]>
--ext-str-file <var=file>
--ext-code <var[=code]>
--ext-code-file <var=file>
-A, --tla-str <var[=val]>
--tla-str-file <var=file>
--tla-code <var[=code]>
--tla-code-file <var=file>
-h, --help Print help
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
The following are taken from the C++ implementation, which is licensed under Apache 2.0.
- The part of the standard library that is implemented in Jsonnet (rsjsonnet-lang/src/program/std.jsonnet).
- Part of the test suite (ui-tests/jsonnet-0.20.0).