Skip to content

Add --show-size flag to ouch list (#1005) - #1052

Open
ChrisJr404 wants to merge 1 commit into
ouch-org:mainfrom
ChrisJr404:feat/list-show-size
Open

Add --show-size flag to ouch list (#1005)#1052
ChrisJr404 wants to merge 1 commit into
ouch-org:mainfrom
ChrisJr404:feat/list-show-size

Conversation

@ChrisJr404

Copy link
Copy Markdown

This adds the --show-size flag to ouch list that was asked for in #1005, so you can see how big each entry is without extracting anything.

The sizes come straight from the archive metadata (tar/zip/7z/rar all report the uncompressed size per entry), so the plain ouch list output is byte-for-byte the same as before and you only get the extra column when you pass the flag. Files show a right-aligned size using the same BytesFmt the rest of ouch uses; directories get a blank, aligned column so things line up. It works in --tree mode too, with the size column sitting to the left of the branches.

$ ouch list proj.tar.gz --show-size
Archive: "proj.tar.gz"
            proj/
 12.00   B  proj/README.md
            proj/src/
  2.00   B  proj/src/tiny.txt
  3.00 kiB  proj/src/big.bin

Added an integration test covering both the flag and the unchanged default output.

Closes ouch-org#1005. The size comes from the archive metadata, so the default
listing stays untouched and only pays for reading sizes when the flag is
passed. Directories get a blank, aligned column and the flag also works
in --tree mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant