domain: add optional on_line callback #15

Merged
pleshevskiy merged 5 commits from pretty-result into main 2022-11-12 16:38:02 +03:00
Showing only changes of commit 8f81bddeaa - Show all commits

View file

@ -41,6 +41,10 @@ impl std::error::Error for Error {}
pub fn execute(args: &Args) -> Result<(), Error> {
let content = std::fs::read_to_string(&args.file).map_err(|_| Error::OpenFile)?;
if args.dry_run {
println!("Your file will be changed to the following")
}
let fs_writer = (!args.dry_run)
.then(|| {
File::create(args.output.as_ref().unwrap_or(&args.file)).map_err(|_| Error::OpenFile)