Skip to content

Commit

Permalink
fixup! Issue #20 add support for tar files too
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Dec 17, 2022
1 parent 0857e40 commit 451b96c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- Replace `optparse` usage with `argparse`
([#10](https://github.com/soxofaan/duviz/issues/10))
- Drop Python 3.5 support ([#27](https://github.com/soxofaan/duviz/issues/27))
- New feature: size breakdown of ZIP files ([#20](https://github.com/soxofaan/duviz/issues/20))
- New feature: size breakdown of ZIP and tar files ([#20](https://github.com/soxofaan/duviz/issues/20))


## [3.1.2] - 2022-12-09
Expand Down
10 changes: 6 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Features
- Detects your terminal width for maximum visualization pleasure.
- Not only supports "disk usage" based on file size,
but also allows to count files (inode count mode)
or give a size breakdown of ZIP files.
or give a size breakdown of ZIP or tar files.
- Option to use terminal colors for the boxes instead of ASCII art


Expand Down Expand Up @@ -95,8 +95,10 @@ If you specify one or more directories, it will render the usage of those direct

Instead of size in bytes, you can also get inode usage: just use the option ``--inodes`` (or ``-i`` in short).

If you directly pass ``duviz`` a ZIP file, it will visualize the size breakdown of the file tree in the ZIP file.
By default, the compresses size will be visualized,
but decompressed size can be shown with option ``--decompressed``.
If you directly pass ``duviz`` a ZIP or tar file,
it will visualize the size breakdown of the file tree in the ZIP/tar file.
In case of ZIP files, the compressed size will be shown by default
(option ``--unzip-size`` will toggle showing of decompressed size).
For tar files, only the decompressed size is available.

Run it with option ``--help`` for more options.
7 changes: 3 additions & 4 deletions duviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,10 +629,9 @@ def main():
help="Force ZIP-file handling of given paths (e.g. lacking a traditional `.zip` extension).",
)
cli.add_argument(
# TODO short option, "-d"?
"--decompressed",
"--unzip-size",
action="store_true",
help="Use decompressed file size instead of compressed file size when processing an archive file (e.g. ZIP)",
help="Visualize decompressed file size instead of compressed file size for ZIP files.",
)
cli.add_argument(
# TODO short option?
Expand Down Expand Up @@ -664,7 +663,7 @@ def main():
if args.zip or (
os.path.isfile(path) and os.path.splitext(path)[1].lower() == ".zip"
):
tree = ZipFileProcessor.from_zipfile(path, compressed=not args.decompressed)
tree = ZipFileProcessor.from_zipfile(path, compressed=not args.unzip_size)
size_formatter = SIZE_FORMATTER_BYTES
elif args.tar or (
os.path.isfile(path)
Expand Down

0 comments on commit 451b96c

Please sign in to comment.