ouch icon indicating copy to clipboard operation
ouch copied to clipboard

Improve unpacking output when creating an empty directory

Open marcospb19 opened this issue 3 years ago • 0 comments

Creating a directory when you're...

unpacking a zip archive:

[INFO] File 12 extracted to "/home/marcospb19/ouch/testing/.tmpmiVaZQ/src/commands/"

unpacking a tar (tar.gz.*) archive:

[INFO] "testing/.tmpcBIpss/src/commands" extracted. (0 B)

The output of both lines should be identical.

For this, we can have a message like "Directory \"...\" created.".


To check if a tar entry is a directory, you can call file.header.entry_type for a tar Entry, here:

https://github.com/ouch-org/ouch/blob/5a97029bde1d0099059e0f0e6d92a82cb9266f4a/src/archive/tar.rs#L31

and check https://docs.rs/tar/latest/tar/enum.EntryType.html#variant.Directory with .is_dir().

marcospb19 avatar Dec 24 '22 06:12 marcospb19