change the api

This commit is contained in:
nora 2021-08-18 19:16:16 +02:00
parent 376a9c53bc
commit 426fb16d7e
5 changed files with 43 additions and 20 deletions

View file

@ -1,5 +1,5 @@
use clap::clap_app;
use jsonformat::format_json;
use jsonformat::{format_json, Indentation};
use std::fs;
use std::io;
use std::io::Read;
@ -36,7 +36,12 @@ fn main() -> Result<(), io::Error> {
.replace("t", "\t")
});
let formatted = format_json(&str, replaced_indent.as_deref());
let indent = match replaced_indent {
Some(ref str) => Indentation::Custom(str),
None => Indentation::Default,
};
let formatted = format_json(&str, indent);
let mut output = matches.value_of("output");
let mut windows_output_default_file: Option<String> = None;