pub mod repair_cmd;
pub mod validate_cmd;
pub mod batch_cmd;
pub mod stream_cmd;
use std::fs;
use std::io::{self, Read};
pub fn read_input(file_path: Option<&str>) -> io::Result<String> {
match file_path {
Some(path) => fs::read_to_string(path),
None => {
let mut buffer = String::new();
io::stdin().read_to_string(&mut buffer)?;
Ok(buffer)
}
}
}
pub fn write_output(content: &str, file_path: Option<&str>) -> io::Result<()> {
match file_path {
Some(path) => fs::write(path, content),
None => {
print!("{}", content);
Ok(())
}
}
}