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.rsdiffbeforeafterboth1use clap::Clap;1use clap::Clap;2use jrsonnet_cli::{ConfigureState, GeneralOpts, InputOpts, ManifestOpts, OutputOpts};2use jrsonnet_cli::{ConfigureState, GeneralOpts, InputOpts, ManifestOpts, OutputOpts};3use jrsonnet_evaluator::{error::LocError, EvaluationState};3use jrsonnet_evaluator::{error::LocError, EvaluationState, ManifestFormat};4use std::{4use std::{5 fs::{create_dir_all, File},5 fs::{create_dir_all, File},6 io::Write,6 io::Write,79 opts.manifest.configure(&state)?;79 opts.manifest.configure(&state)?;808081 let val = if opts.input.exec {81 let val = if opts.input.exec {82 state.set_manifest_format(ManifestFormat::ToString);82 state.evaluate_snippet_raw(83 state.evaluate_snippet_raw(83 Rc::new(PathBuf::from("args")),84 Rc::new(PathBuf::from("args")),84 (&opts.input.input as &str).into(),85 (&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),