diff --git a/src/commands.rs b/src/commands.rs index bf278b6..df70a76 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -85,12 +85,12 @@ pub fn run(command: Command, flags: &oof::Flags) -> crate::Result<()> { return Err(Error::with_reason(reason)); } - if let Some(format) = formats.iter().skip(1).position(|format| matches!(format, Tar | Zip)) { + if let Some(format) = formats.iter().skip(1).find(|format| matches!(format, Tar | Zip)) { let reason = FinalError::with_title(format!("Cannot compress to '{}'.", to_utf(&output_path))) .detail(format!("Found the format '{}' in an incorrect position.", format)) - .detail(format!("{} can only be used at the start of the file extension.", format)) - .hint(format!("If you wish to compress multiple files, start the extension with {}.", format)) - .hint(format!("Otherwise, remove {} from '{}'.", format, to_utf(&output_path))) + .detail(format!("'{}' can only be used at the start of the file extension.", format)) + .hint(format!("If you wish to compress multiple files, start the extension with '{}'.", format)) + .hint(format!("Otherwise, remove the last '{}' from '{}'.", format, to_utf(&output_path))) .into_owned(); return Err(Error::with_reason(reason));