Support excluding filesystems with -x

https://github.com/bootandy/dust/issues/50

Add optional -x flag to limit search to the current filesystem.

Add (untested) support for windows for the equivalent of inode and
device.
This commit is contained in:
andy.boot
2020-01-15 19:51:16 +00:00
parent f395a7d768
commit bdc3d404ef
3 changed files with 74 additions and 4 deletions
+13 -1
View File
@@ -54,6 +54,12 @@ fn main() {
.long("full-paths")
.help("If set sub directories will not have their path shortened"),
)
.arg(
Arg::with_name("limit_filesystem")
.short("x")
.long("limit-filesystem")
.help("Only count the files and directories in the same filesystem as the supplied directory"),
)
.arg(
Arg::with_name("display_apparent_size")
.short("s")
@@ -110,9 +116,15 @@ fn main() {
}
let use_apparent_size = options.is_present("display_apparent_size");
let limit_filesystem = options.is_present("limit_filesystem");
let simplified_dirs = simplify_dir_names(target_dirs);
let (permissions, nodes) = get_dir_tree(&simplified_dirs, use_apparent_size, threads);
let (permissions, nodes) = get_dir_tree(
&simplified_dirs,
use_apparent_size,
limit_filesystem,
threads,
);
let sorted_data = sort(nodes);
let biggest_ones = {
match depth {