Skip to content

A Rust implementation of the Jsonnet language

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

eduardosm/rsjsonnet

Repository files navigation

rsjsonnet

GitHub Actions Status MSRV

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.

Command line program

Pre-built binaries

You can download binaries of the command line for Linux and Windows from the GitHub releases page.

Build from source

If you have a Rust toolchain installed on your system, you can build the latest version with:

cargo install --locked rsjsonnet

Usage

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

License

Licensed under either of

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.

About

A Rust implementation of the Jsonnet language

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published