mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-05 02:55:31 +00:00
avoid directly indexing when possible
This commit is contained in:
parent
e06b2c8635
commit
c7165fb52c
@ -149,11 +149,10 @@ pub fn run(
|
||||
let error = FinalError::with_title(format!("Cannot compress to '{output_path}'."))
|
||||
.detail(first_detail_message)
|
||||
.detail(format!(
|
||||
"The compression format '{}' does not accept multiple files.",
|
||||
&formats[0]
|
||||
"The compression format '{first_format}' does not accept multiple files.",
|
||||
))
|
||||
.detail("Formats that bundle files into an archive are .tar and .zip.")
|
||||
.hint(format!("Try inserting '.tar' or '.zip' before '{}'.", &formats[0]))
|
||||
.hint(format!("Try inserting '.tar' or '.zip' before '{first_format}'."))
|
||||
.hint(format!("From: {output_path}"))
|
||||
.hint(format!("To: {suggested_output_path}"));
|
||||
|
||||
@ -245,7 +244,7 @@ pub fn run(
|
||||
.map(|(input_path, _)| PathBuf::from(input_path))
|
||||
.collect();
|
||||
|
||||
if !files_missing_format.is_empty() {
|
||||
if let Some(path) = files_missing_format.first() {
|
||||
let error = FinalError::with_title("Cannot decompress files without extensions")
|
||||
.detail(format!(
|
||||
"Files without supported extensions: {}",
|
||||
@ -258,7 +257,7 @@ pub fn run(
|
||||
.hint("Or overwrite this option with the '--format' flag:")
|
||||
.hint(format!(
|
||||
" ouch decompress {} --format tar.gz",
|
||||
to_utf(&files_missing_format[0])
|
||||
EscapedPathDisplay::new(path),
|
||||
));
|
||||
|
||||
return Err(error.into());
|
||||
|
Loading…
x
Reference in New Issue
Block a user