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]> Provide an external variable as a string
--ext-str-file <var=file> Provide an external variable as a string read from a file
--ext-code <var[=code]> Provide an external variable as code
--ext-code-file <var=file> Provide an external variable as code read from a file
-A, --tla-str <var[=val]> Provide a top-level argument as a string
--tla-str-file <var=file> Provide a top-level argument as a string read from a file
--tla-code <var[=code]> Provide a top-level argument as code
--tla-code-file <var=file> Provide a top-level argument as code read from a 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.
Part of the test suite (ui-tests/jsonnet-0.20.0) is taken from the C++ implementation, which is licensed under Apache 2.0.