Skip to main content

capture

Function capture 

Source
pub fn capture(
    argv: &[String],
    stdin: &mut dyn Read,
    extra: &BTreeMap<String, Plugin>,
) -> Captured
Expand description

Run the command and collect what it printed instead of writing it to a stream, so a caller can inspect the individual printed entries.

let argv: Vec<String> = ["jsonic", "-n", "a:1"].iter().map(|s| s.to_string()).collect();
let out = tabnas_jsonic_cli::capture(&argv, &mut std::io::empty(), &Default::default());
assert_eq!(out.code, 0);
assert_eq!(out.lines, vec!["{\n  \"a\": 1\n}".to_string()]);