diff --git a/src/main.rs b/src/main.rs index 789c48d..b4a15b1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,6 +61,7 @@ fn main_impl() -> Result> { let mut buffer = vec![]; // write header and paths + writeln!(buffer, "// clear the file to abort the rename")?; writeln!(buffer, "// empty lines and coments are ignored")?; writeln!(buffer, "// do not remove or reorder any lines")?; writeln!(buffer, "// do not edit anything other than file stems")?; @@ -99,6 +100,11 @@ fn main_impl() -> Result> { drop(file); + if after.is_empty() { + eprintln!("file empty, aborted rename"); + return Ok(ExitCode::FAILURE); + } + if before.len() != after.len() { eprintln!( "had {} path(s) before, but {} path(s) after",