diff --git a/CHANGELOG.md b/CHANGELOG.md index f045bbe38..2b1ca472f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,6 @@ Categories Used: - Support decompression of concatenated `.gz`, `.bz2`, and `.lz4` (https://github.com/ouch-org/ouch/pull/898) ### Improvements - - Give better error messages when archive extensions are invalid (https://github.com/ouch-org/ouch/pull/817) - Improve misleading error message (https://github.com/ouch-org/ouch/pull/818) - Add aliases for `--password` flag (`--pass` and `--pw`) (https://github.com/ouch-org/ouch/pull/847) @@ -44,6 +43,7 @@ Categories Used: - Refactor/simplify logger (https://github.com/ouch-org/ouch/pull/888) - Print input and output file sizes (https://github.com/ouch-org/ouch/pull/914) - Make path printing concise and consistent (https://github.com/ouch-org/ouch/pull/916) +- Unify directory extraction message for zip and tar archives (https://github.com/ouch-org/ouch/pull/937) ### Bug Fixes diff --git a/src/archive/tar.rs b/src/archive/tar.rs index af02cd673..aadb3df88 100644 --- a/src/archive/tar.rs +++ b/src/archive/tar.rs @@ -79,11 +79,15 @@ pub fn unpack_archive(reader: impl Read, output_folder: &Path) -> Result { _ => continue, } - info!( - "extracted ({}) {:?}", - BytesFmt(file.size()), - PathFmt(&output_folder.join(file.path()?)), - ); + if file.header().entry_type().is_dir() { + info!("Directory {:?} created", PathFmt(&output_folder.join(file.path()?))); + } else { + info!( + "extracted ({}) {:?}", + BytesFmt(file.size()), + PathFmt(&output_folder.join(file.path()?)), + ); + } files_unpacked += 1; } diff --git a/src/archive/zip.rs b/src/archive/zip.rs index 42fd83ad8..05532717d 100644 --- a/src/archive/zip.rs +++ b/src/archive/zip.rs @@ -53,7 +53,7 @@ where match file.name().ends_with('/') { _is_dir @ true => { - info!("File {} extracted to {:?}", idx, PathFmt(&file_path)); + info!("Directory {:?} created", PathFmt(&file_path)); let mode = file.unix_mode(); let is_symlink = mode.is_some_and(|mode| mode & 0o170000 == 0o120000); diff --git a/tests/snapshots/ui__ui_test_ok_decompress_multiple_files.snap b/tests/snapshots/ui__ui_test_ok_decompress_multiple_files.snap index b97d95e7c..5ea40b194 100644 --- a/tests/snapshots/ui__ui_test_ok_decompress_multiple_files.snap +++ b/tests/snapshots/ui__ui_test_ok_decompress_multiple_files.snap @@ -2,9 +2,9 @@ source: tests/ui.rs expression: "lines.join(\"\\n\")" --- +[INFO] Directory "output/input" created [INFO] Files unpacked: 4 [INFO] Successfully decompressed archive to "output" -[INFO] extracted ( [SIZE]) "output/input" [INFO] extracted ( [SIZE]) "output/input/input" [INFO] extracted ( [SIZE]) "output/input/input2" [INFO] extracted ( [SIZE]) "output/input/input3"