···2525 }
2626 let path = &paths[0];
2727 if path.is_dir() {
2828- bail!("{name} does not operate on directories; specify a file instead.");
2828+ bail!("{name} does not operate on directories; specify a file instead");
2929 }
3030 let size = std::fs::metadata(path)?.len();
3131 let reader: Box<dyn Read + Send> = Box::new(BufReader::new(File::open(path)?));
···4343 if let CmprssOutput::Path(path) = output
4444 && path.is_dir()
4545 {
4646- bail!("{name} does not operate on directories; specify an output file instead.");
4646+ bail!("{name} does not operate on directories; specify an output file instead");
4747 }
4848 Ok(())
4949}
+5-5
src/backends/tar.rs
···7878 match input {
7979 CmprssInput::Path(paths) => {
8080 if paths.len() != 1 {
8181- bail!("tar extraction expects a single archive file");
8181+ bail!("tar extraction expects exactly one archive file");
8282 }
8383 let file = File::open(&paths[0])?;
8484 let mut archive = Archive::new(file);
···109109 CmprssOutput::Writer(mut writer) => match input {
110110 CmprssInput::Path(paths) => {
111111 if paths.len() != 1 {
112112- bail!("tar extraction expects a single archive file");
112112+ bail!("tar extraction expects exactly one archive file");
113113 }
114114 let mut file = File::open(&paths[0])?;
115115 io::copy(&mut file, &mut writer)?;
···131131 let reader: Box<dyn Read> = match input {
132132 CmprssInput::Path(paths) => {
133133 if paths.len() != 1 {
134134- bail!("tar listing expects a single archive file");
134134+ bail!("tar listing expects exactly one archive file");
135135 }
136136 Box::new(File::open(&paths[0])?)
137137 }
···164164 } else if path.is_dir() {
165165 archive.append_dir_all(path.file_name().unwrap(), path.as_path())?;
166166 } else {
167167- bail!("unsupported file type for tar compression");
167167+ bail!("tar does not support this file type");
168168 }
169169 }
170170 }
···176176 archive.append_file("archive", &mut temp_file)?;
177177 }
178178 CmprssInput::Reader(_) => {
179179- bail!("Cannot tar a reader input directly");
179179+ bail!("tar does not accept an in-memory reader input");
180180 }
181181 }
182182 Ok(archive.finish()?)
+6-6
src/backends/zip.rs
···4242 let base = path.parent().unwrap_or(&path);
4343 add_directory(&mut zip_writer, base, &path)?;
4444 } else {
4545- bail!("unsupported file type for zip compression");
4545+ bail!("zip does not support this file type");
4646 }
4747 }
4848 }
···5252 io::copy(&mut pipe, &mut zip_writer)?;
5353 }
5454 CmprssInput::Reader(_) => {
5555- bail!("Cannot zip a reader input");
5555+ bail!("zip does not accept an in-memory reader input");
5656 }
5757 }
5858···112112 match input {
113113 CmprssInput::Path(paths) => {
114114 if paths.len() != 1 {
115115- bail!("zip extraction expects a single archive file");
115115+ bail!("zip extraction expects exactly one archive file");
116116 }
117117 let file = File::open(&paths[0])?;
118118 let mut archive = ZipArchive::new(file)?;
···134134 }
135135 CmprssInput::Reader(_) => {
136136 bail!(
137137- "Cannot extract from a reader input for zip (requires seekable input)"
137137+ "zip extraction does not accept an in-memory reader input (requires seekable input)"
138138 )
139139 }
140140 }
···143143 CmprssOutput::Writer(mut writer) => match input {
144144 CmprssInput::Path(paths) => {
145145 if paths.len() != 1 {
146146- bail!("zip extraction expects a single archive file");
146146+ bail!("zip extraction expects exactly one archive file");
147147 }
148148 let mut file = File::open(&paths[0])?;
149149 io::copy(&mut file, &mut writer)?;
···169169 match input {
170170 CmprssInput::Path(paths) => {
171171 if paths.len() != 1 {
172172- bail!("zip listing expects a single archive file");
172172+ bail!("zip listing expects exactly one archive file");
173173 }
174174 let archive = ZipArchive::new(File::open(&paths[0])?)?;
175175 for name in archive.file_names() {
+10-10
src/job.rs
···9797 if !std::io::stdin().is_terminal() && !args.ignore_pipes && !args.ignore_stdin {
9898 return Ok(CmprssInput::Pipe(std::io::stdin()));
9999 }
100100- bail!("No specified input");
100100+ bail!("No input specified");
101101}
102102103103/// Whether we can send the output to stdout (piped, and the user hasn't
···225225 let input_path = get_input_filename(input)?;
226226 match action {
227227 Some(Action::Compress) => {
228228- let c = compressor.ok_or_else(|| anyhow!("Must specify a compressor"))?;
228228+ let c = compressor.ok_or_else(|| anyhow!("Could not determine compressor to use"))?;
229229 Ok((c, Action::Compress))
230230 }
231231 Some(Action::Extract) => {
232232 let c = compressor
233233 .or_else(|| get_compressor_from_filename(input_path))
234234- .ok_or_else(|| anyhow!("Must specify a compressor"))?;
234234+ .ok_or_else(|| anyhow!("Could not determine compressor to use"))?;
235235 Ok((c, Action::Extract))
236236 }
237237 // List is handled by the short-circuit at the top of get_job and
···249249 None => {
250250 // The input has to be something we can identify as an archive.
251251 let c = get_compressor_from_filename(input_path)
252252- .ok_or_else(|| anyhow!("Must specify a compressor"))?;
252252+ .ok_or_else(|| anyhow!("Could not determine compressor to use"))?;
253253 Ok((c, Action::Extract))
254254 }
255255 },
···276276 Some(Action::Extract) => {
277277 if let CmprssInput::Path(paths) = input {
278278 if paths.len() != 1 {
279279- bail!("Expected a single archive to extract");
279279+ bail!("Expected exactly one input archive");
280280 }
281281 *compressor = get_compressor_from_filename(paths.first().unwrap());
282282 }
···288288 *action = Some(Action::Extract);
289289 if compressor.is_none() {
290290 bail!(
291291- "Couldn't determine how to extract {:?}",
291291+ "Could not determine compressor for {:?}",
292292 paths.first().unwrap()
293293 );
294294 }
···306306 });
307307 } else {
308308 if paths.len() != 1 {
309309- bail!("Expected a single input file for piping to stdout");
309309+ bail!("Expected exactly one input file when writing to stdout");
310310 }
311311 *compressor = get_compressor_from_filename(paths.first().unwrap());
312312 if compressor.is_some() {
313313 *action = Some(Action::Extract);
314314 } else {
315315- bail!("Can't guess compressor to use");
315315+ bail!("Could not determine compressor to use");
316316 }
317317 }
318318 }
···332332 if compressor.is_some() {
333333 *action = Some(Action::Compress);
334334 } else {
335335- bail!("Can't guess compressor to use");
335335+ bail!("Could not determine compressor to use");
336336 }
337337 }
338338 }
···354354 match input {
355355 CmprssInput::Path(paths) => match paths.first() {
356356 Some(path) => Ok(path),
357357- None => bail!("error: no input specified"),
357357+ None => bail!("No input specified"),
358358 },
359359 CmprssInput::Pipe(_) => Ok(Path::new("archive")),
360360 CmprssInput::Reader(_) => Ok(Path::new("piped_data")),