domain: add optional on_line callback #15
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue