mirror of
https://github.com/Noratrieb/jsonformat.git
synced 2026-01-14 14:15:03 +01:00
cleanup
This commit is contained in:
parent
61e1e5d6fb
commit
28c691da5b
10 changed files with 11429 additions and 66 deletions
|
|
@ -15,7 +15,7 @@ categories = ["command-line-utilities"]
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
jsonformat = { path = "..", version = "1.2.0" }
|
||||
jsonformat = { path = "..", version = "2.0.0" }
|
||||
clap = "2.33.3"
|
||||
|
||||
[[bin]]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
use std::{
|
||||
error::Error,
|
||||
fs::File,
|
||||
io::{BufReader, BufWriter, Read, Write},
|
||||
};
|
||||
|
||||
use clap::clap_app;
|
||||
use jsonformat::{format_json_buffered, Indentation};
|
||||
use std::error::Error;
|
||||
use std::fs::File;
|
||||
use std::io::{BufReader, BufWriter, Read, Write};
|
||||
use jsonformat::{format_reader_writer, Indentation};
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let matches = clap_app!(jsonformat =>
|
||||
|
|
@ -64,16 +67,16 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
Some(filename) => {
|
||||
file = File::create(filename)?;
|
||||
&mut file
|
||||
},
|
||||
}
|
||||
None => {
|
||||
stdout = std::io::stdout();
|
||||
&mut stdout
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
let mut reader = BufReader::new(reader);
|
||||
let mut writer = BufWriter::new(writer);
|
||||
format_json_buffered(&mut reader, &mut writer, indent)?;
|
||||
format_reader_writer(&mut reader, &mut writer, indent)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue