Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Display total size of current directory #334

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

krivahtoo
Copy link
Contributor

Add the option to display lazily loaded directory sizes.

The displayed size is not accurate, to get the actual size of a directory one has to navigate recursively to all its child directories.

[display]
# ...
# Options include:
# - count (use the number of items in the directory)
# - size (use the total size of items in a directory)
size_mode = "count"
# ...

Screenshot

2023-06-10-215616_714x444_scrot

closes #229

add option to display lazily loaded directory sizes
@DLFW
Copy link
Contributor

DLFW commented Jun 11, 2023

Hi!

When I have not visited all sub-dirs, does Joshuto show the wrong directory size?

If yes, is there some way to know which sub-dirs I have visited and which are not included in the total size yet?

@krivahtoo
Copy link
Contributor Author

When I have not visited all sub-dirs, does Joshuto show the wrong directory size?

Yes. Without visiting sub-dirs, it will only calculate the total size of files in the directory.

If yes, is there some way to know which sub-dirs I have visited and which are not included in the total size yet?

No.

Having such a feature would be great though I am not sure how it would be implemented without traversing the directory.

@DLFW
Copy link
Contributor

DLFW commented Jun 11, 2023

Hm, I just have a concern that this behavior breaks user-expectations, because people either check the sizes of files or a directory fully recursive (maybe except of other file-system mounted in the sub-tree and alike). I have never seen such a “partial dir-size” calculation, and I would certainly not expect this. @fritzrehde was also asking for a du -hs equivalent in #229, and that will always include the complete sub-tree. I'm not sure if this PR would suit his use-case.

Furthermore, users would not have a chance to see that their expectation is wrong unless they realize that “something with the size does not look right”. That's a dangerous combination in terms of usability, and in this case even more as a directory size might be considered in decisions about deleting, coping, or moving files.

I also don't see a use-case for this “partial dir-size” where I have to remember what sub-dirs I have visited before, but maybe I'm missing something.

Sorry, I don't want to interfere in your MR, and I'm really a fan of all your Joshuto contributions, but I have some serious concerns about this one.

@krivahtoo
Copy link
Contributor Author

Okay, I see what you mean. Yeah, this will probably break user expectations.

Thanks for your feedback.

I think the solution would be to calculate but only show the size when all the files/dirs have been calculated and/or add a command to traverse the directory. This way the users would see the directory size only when it has been fully calculated.

@krivahtoo krivahtoo marked this pull request as draft June 12, 2023 12:26
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.

Display total size of current directory
2 participants