difftreelog
Merge pull request #16 from CertainLach/exec-to-string
in: master
--exec should use toString format instead of standard json
2 files changed
cmds/jrsonnet/src/main.rsdiffbeforeafterboth--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -1,6 +1,6 @@
use clap::Clap;
use jrsonnet_cli::{ConfigureState, GeneralOpts, InputOpts, ManifestOpts, OutputOpts};
-use jrsonnet_evaluator::{error::LocError, EvaluationState};
+use jrsonnet_evaluator::{error::LocError, EvaluationState, ManifestFormat};
use std::{
fs::{create_dir_all, File},
io::Write,
@@ -79,6 +79,7 @@
opts.manifest.configure(&state)?;
let val = if opts.input.exec {
+ state.set_manifest_format(ManifestFormat::ToString);
state.evaluate_snippet_raw(
Rc::new(PathBuf::from("args")),
(&opts.input.input as &str).into(),
crates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth201 YamlStream(Box<ManifestFormat>),201 YamlStream(Box<ManifestFormat>),202 Yaml(usize),202 Yaml(usize),203 Json(usize),203 Json(usize),204 ToString,204 String,205 String,205}206}206207357 }358 }358 ManifestFormat::Yaml(padding) => self.to_yaml(*padding)?,359 ManifestFormat::Yaml(padding) => self.to_yaml(*padding)?,359 ManifestFormat::Json(padding) => self.to_json(*padding)?,360 ManifestFormat::Json(padding) => self.to_json(*padding)?,361 ManifestFormat::ToString => self.to_string()?,360 ManifestFormat::String => match self {362 ManifestFormat::String => match self {361 Self::Str(s) => s.clone(),363 Self::Str(s) => s.clone(),362 _ => throw!(StringManifestOutputIsNotAString),364 _ => throw!(StringManifestOutputIsNotAString),