* fix: Limit file size based on the file system I/O block size
* fix: Take possible file pre-allocation into account
* refactor: Reduce indenting with early return
* refactor: Fix clippy::manual_div_ceil
* fix: Use target_size instead of max_size
* fix: Take possible pre-allocation for a file into account
https://github.com/bootandy/dust/pull/487#issuecomment-2816885444
Previously, we attempted to perform a clean shutdown, which could take a
significant period of time on slow filesystems. This commit changes the
shutdown logic to abort immedietly when ^C is received by the program.
If we run `dust /usr/*/Trash`
We see several 'Trash' directories in the output but do not know which
user they belong to.
This fix means if we see duplicate names in a directory we will display
the parent directory name as well
Before we calculated the % by taking the longest bar. If you use
--skip-total the longest bar is not the total. We need to sum up all the
children of root to work out what the largest size is.
Previously, the function get_metadata in platform.rs used `fs::metadata` which follows symbolic links
and returns metadata for the target file. This caused issues #421: du / dust disagreement
when trying to determine properties of the symbolic link itself
This PR addresses an issue where `target_dirs` were being optimized out\
before being passed to the `get_filesystem_devices()` function.
The changes in this PR ensure that `target_dirs` are passed directly
to `get_filesystem_devices()`, and only then are they simplified.
Example of a command that currently doesn't work correctly:
```sh
dust -x $(findmnt -S tmpfs -o target -n)
```
It should show the usage of all tmpfs mounts, but it currently shows
just the the root mountpoints like `/run`, since all the mountpoints
nested under it are optimized out.
Because I'm not familiar with Rust, when I was working on
https://github.com/bootandy/dust/pull/390 I didn't realize that the
completions were auto-generated via clap. I'm sorry. This redoes it
with clap.
This improves not only the completions but also the --help and the
man page. Also the --output-format flag will raise an error if the
given value is invalid.
Currently options following regular arguments are not interpreted as
options. This fixes that.
Users can still treat values starting with a hyphen (`-`) as regular
arguments by using `--`, e.g.:
dust -d 2 -r ~/Documents -F -- --this-is-my-dir