Merge branch 'main' into large

This commit is contained in:
figsoda 2023-01-31 18:08:24 -05:00 committed by GitHub
commit 634978fea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 15 deletions

View File

@ -28,6 +28,8 @@ Categories Used:
- Fix decompression of zip archives with files larger than 4GB [\#354](https://github.com/ouch-org/ouch/pull/354) ([figsoda](https://github.com/figsoda)) - Fix decompression of zip archives with files larger than 4GB [\#354](https://github.com/ouch-org/ouch/pull/354) ([figsoda](https://github.com/figsoda))
- Fix handling of unknown extensions during decompression [\#355](https://github.com/ouch-org/ouch/pull/355) ([figsoda](https://github.com/figsoda))
## [0.4.1](https://github.com/ouch-org/ouch/compare/0.4.0...0.4.1) ## [0.4.1](https://github.com/ouch-org/ouch/compare/0.4.0...0.4.1)
### New Features ### New Features
@ -103,7 +105,7 @@ Categories Used:
- Optimize `strip_cur_dir` [\#167](https://github.com/ouch-org/ouch/pull/167) ([vrmiguel](https://github.com/vrmiguel)) - Optimize `strip_cur_dir` [\#167](https://github.com/ouch-org/ouch/pull/167) ([vrmiguel](https://github.com/vrmiguel))
- Improve zip errors when paths are not utf8 valid [\#181](https://github.com/ouch-org/ouch/pull/181) ([marcospb19](https://github.com/marcospb19)) - Improve zip errors when paths are not utf8 valid [\#181](https://github.com/ouch-org/ouch/pull/181) ([marcospb19](https://github.com/marcospb19))
- Simplify/optimize several file inferring functions [\#204](https://github.com/ouch-org/ouch/pull/204) ([vrmiguel](https://github.com/vrmiguel)) - Simplify/optimize several file inferring functions [\#204](https://github.com/ouch-org/ouch/pull/204) ([vrmiguel](https://github.com/vrmiguel))
- List command: print file immediatly after it is processed [\#225](https://github.com/ouch-org/ouch/pull/225) ([sigmaSd](https://github.com/sigmaSd)) - List command: print file immediately after it is processed [\#225](https://github.com/ouch-org/ouch/pull/225) ([sigmaSd](https://github.com/sigmaSd))
- Use `Cow<'static, str>` in `FinalError` [\#246](https://github.com/ouch-org/ouch/pull/246) ([vrmiguel](https://github.com/vrmiguel)) - Use `Cow<'static, str>` in `FinalError` [\#246](https://github.com/ouch-org/ouch/pull/246) ([vrmiguel](https://github.com/vrmiguel))
- Don't allocate when possible in `to_utf`, `nice_directory_display` [\#249](https://github.com/ouch-org/ouch/pull/249) ([vrmiguel](https://github.com/vrmiguel)) - Don't allocate when possible in `to_utf`, `nice_directory_display` [\#249](https://github.com/ouch-org/ouch/pull/249) ([vrmiguel](https://github.com/vrmiguel))
- Allow overriding the completions output directory [\#251]](https://github.com/ouch-org/ouch/pull/251) ([jcgruenhage](https://github.com/jcgruenhage)) - Allow overriding the completions output directory [\#251]](https://github.com/ouch-org/ouch/pull/251) ([jcgruenhage](https://github.com/jcgruenhage))
@ -178,14 +180,14 @@ Categories Used:
- Empty folders are ignored in archive compression formats [\#41](https://github.com/ouch-org/ouch/issues/41) ([GabrielSimonetto](https://github.com/GabrielSimonetto)) - Empty folders are ignored in archive compression formats [\#41](https://github.com/ouch-org/ouch/issues/41) ([GabrielSimonetto](https://github.com/GabrielSimonetto))
- fix macOS executable paths [\#69](https://github.com/ouch-org/ouch/pull/69) ([vrmiguel](https://github.com/vrmiguel)) - fix macOS executable paths [\#69](https://github.com/ouch-org/ouch/pull/69) ([vrmiguel](https://github.com/vrmiguel))
- Print the format type when the format is in an incorrent position [\#84](https://github.com/ouch-org/ouch/pull/84) ([dcariotti](https://github.com/dcariotti)) - Print the format type when the format is in an incorrect position [\#84](https://github.com/ouch-org/ouch/pull/84) ([dcariotti](https://github.com/dcariotti))
- Compressing a single file to a single format that's not `tar` or `zip` panics [\#87](https://github.com/ouch-org/ouch/issues/87) & [\#89](https://github.com/ouch-org/ouch/pull/89) ([marcospb19](https://github.com/marcospb19)) - Compressing a single file to a single format that's not `tar` or `zip` panics [\#87](https://github.com/ouch-org/ouch/issues/87) & [\#89](https://github.com/ouch-org/ouch/pull/89) ([marcospb19](https://github.com/marcospb19))
- Compression flag `--output` not working with single file compression [\#90](https://github.com/ouch-org/ouch/issues/90) & [\#93](https://github.com/ouch-org/ouch/pull/93) ([figsoda](https://github.com/figsoda)) - Compression flag `--output` not working with single file compression [\#90](https://github.com/ouch-org/ouch/issues/90) & [\#93](https://github.com/ouch-org/ouch/pull/93) ([figsoda](https://github.com/figsoda))
- Fix NO_COLOR issues, remove some dead code [\#66](https://github.com/ouch-org/ouch/issues/66), [\#62](https://github.com/ouch-org/ouch/issues/62), & [\#95](https://github.com/ouch-org/ouch/pull/95) ([figsoda](https://github.com/figsoda)) - Fix NO_COLOR issues, remove some dead code [\#66](https://github.com/ouch-org/ouch/issues/66), [\#62](https://github.com/ouch-org/ouch/issues/62), & [\#95](https://github.com/ouch-org/ouch/pull/95) ([figsoda](https://github.com/figsoda))
- Add proper error message when using conflicting flags \(e.g. `--yes --no`\) [\#55](https://github.com/ouch-org/ouch/issues/55) & [\#99](https://github.com/ouch-org/ouch/pull/99) ([SpyrosRoum](https://github.com/SpyrosRoum)) - Add proper error message when using conflicting flags \(e.g. `--yes --no`\) [\#55](https://github.com/ouch-org/ouch/issues/55) & [\#99](https://github.com/ouch-org/ouch/pull/99) ([SpyrosRoum](https://github.com/SpyrosRoum))
- Fix wrong archive format detection patterns [\#125](https://github.com/ouch-org/ouch/pull/125) ([SpyrosRoum](https://github.com/SpyrosRoum)) - Fix wrong archive format detection patterns [\#125](https://github.com/ouch-org/ouch/pull/125) ([SpyrosRoum](https://github.com/SpyrosRoum))
- Decompressing file without extension gives bad error message [\#137](https://github.com/ouch-org/ouch/issues/137) ([marcospb19](https://github.com/marcospb19)) - Decompressing file without extension gives bad error message [\#137](https://github.com/ouch-org/ouch/issues/137) ([marcospb19](https://github.com/marcospb19))
- Fix decompression overwritting files without asking and failing on directories [\#141](https://github.com/ouch-org/ouch/pull/141) ([SpyrosRoum](https://github.com/SpyrosRoum)) - Fix decompression overwriting files without asking and failing on directories [\#141](https://github.com/ouch-org/ouch/pull/141) ([SpyrosRoum](https://github.com/SpyrosRoum))
### Improvements ### Improvements

1
Cargo.lock generated
View File

@ -714,7 +714,6 @@ dependencies = [
"xz2", "xz2",
"zip", "zip",
"zstd", "zstd",
"zstd-sys",
] ]
[[package]] [[package]]

View File

@ -33,9 +33,6 @@ ubyte = { version = "0.10.3", default-features = false }
xz2 = "0.1.7" xz2 = "0.1.7"
zip = { version = "0.6.3", default-features = false, features = ["time"] } zip = { version = "0.6.3", default-features = false, features = ["time"] }
zstd = { version = "0.12.2", default-features = false } zstd = { version = "0.12.2", default-features = false }
# zstd-sys > 2.0.1 unconditionally enables thin LTO and causes CI to fail
# https://github.com/gyscos/zstd-rs/pull/155
zstd-sys = "=2.0.1"
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
time = { version = "0.3.17", default-features = false } time = { version = "0.3.17", default-features = false }

View File

@ -366,7 +366,7 @@ fn check_mime_type(
// File with no extension // File with no extension
// Try to detect it automatically and prompt the user about it // Try to detect it automatically and prompt the user about it
if let Some(detected_format) = try_infer_extension(path) { if let Some(detected_format) = try_infer_extension(path) {
// Infering the file extension can have unpredicted consequences (e.g. the user just // Inferring the file extension can have unpredicted consequences (e.g. the user just
// mistyped, ...) which we should always inform the user about. // mistyped, ...) which we should always inform the user about.
info!( info!(
accessible, accessible,

View File

@ -1,6 +1,6 @@
//! Error types definitions. //! Error types definitions.
//! //!
//! All usage errors will pass throught the Error enum, a lot of them in the Error::Custom. //! All usage errors will pass through the Error enum, a lot of them in the Error::Custom.
use std::{ use std::{
borrow::Cow, borrow::Cow,
@ -73,7 +73,7 @@ impl Display for FinalError {
if !self.hints.is_empty() { if !self.hints.is_empty() {
// Separate by one blank line. // Separate by one blank line.
writeln!(f)?; writeln!(f)?;
// to reduce redundant output for text-to-speach systems, braille // to reduce redundant output for text-to-speech systems, braille
// displays and so on, only print "hints" once in ACCESSIBLE mode // displays and so on, only print "hints" once in ACCESSIBLE mode
if is_running_in_accessible_mode() { if is_running_in_accessible_mode() {
write!(f, "\n{}hints:{}", *GREEN, *RESET)?; write!(f, "\n{}hints:{}", *GREEN, *RESET)?;

View File

@ -113,11 +113,12 @@ fn to_extension(ext: &[u8]) -> Option<Extension> {
)) ))
} }
fn split_extension<'a>(name: &mut &'a [u8]) -> Option<&'a [u8]> { fn split_extension(name: &mut &[u8]) -> Option<Extension> {
let (new_name, ext) = name.rsplit_once_str(b".")?; let (new_name, ext) = name.rsplit_once_str(b".")?;
if matches!(new_name, b"" | b"." | b"..") { if matches!(new_name, b"" | b"." | b"..") {
return None; return None;
} }
let ext = to_extension(ext)?;
*name = new_name; *name = new_name;
Some(ext) Some(ext)
} }
@ -149,7 +150,7 @@ pub fn separate_known_extensions_from_name(path: &Path) -> (&Path, Vec<Extension
}; };
// While there is known extensions at the tail, grab them // While there is known extensions at the tail, grab them
while let Some(extension) = split_extension(&mut name).and_then(to_extension) { while let Some(extension) = split_extension(&mut name) {
extensions.insert(0, extension); extensions.insert(0, extension);
} }

View File

@ -5,14 +5,14 @@
/// There are essentially two different versions of the `info!()` macro: /// There are essentially two different versions of the `info!()` macro:
/// - `info!(accessible, ...)` should only be used for short, important /// - `info!(accessible, ...)` should only be used for short, important
/// information which is expected to be useful for e.g. blind users whose /// information which is expected to be useful for e.g. blind users whose
/// text-to-speach systems read out every output line, which is why we /// text-to-speech systems read out every output line, which is why we
/// should reduce nonessential output to a minimum when running in /// should reduce nonessential output to a minimum when running in
/// ACCESSIBLE mode /// ACCESSIBLE mode
/// - `info!(inaccessible, ...)` can be used more carelessly / for less /// - `info!(inaccessible, ...)` can be used more carelessly / for less
/// important information. A seeing user can easily skim through more lines /// important information. A seeing user can easily skim through more lines
/// of output, so e.g. reporting every single processed file can be helpful, /// of output, so e.g. reporting every single processed file can be helpful,
/// while it would generate long and hard to navigate text for blind people /// while it would generate long and hard to navigate text for blind people
/// who have to have each line of output read to them aloud, whithout to /// who have to have each line of output read to them aloud, without to
/// ability to skip some lines deemed not important like a seeing person would. /// ability to skip some lines deemed not important like a seeing person would.
#[macro_export] #[macro_export]
macro_rules! info { macro_rules! info {

View File

@ -80,7 +80,7 @@ pub fn assert_same_directory(x: impl Into<PathBuf>, y: impl Into<PathBuf>, prese
(x, y) => { (x, y) => {
panic!( panic!(
"directories don't have the same number of entires\n left: `{:?}`,\n right: `{:?}`", "directories don't have the same number of entries\n left: `{:?}`,\n right: `{:?}`",
x.map(|x| x.path()), x.map(|x| x.path()),
y.map(|y| y.path()), y.map(|y| y.path()),
) )