Add option to ignore directories

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

Add -X flag used to ignore any file or directory that matches the
provided substring.
This means that -X e will ignore any file or directory with an 'e' in
it.
This commit is contained in:
andy.boot
2020-01-18 23:12:01 +00:00
parent f64e0094f1
commit d97edba041
3 changed files with 52 additions and 0 deletions
+9
View File
@@ -54,6 +54,13 @@ fn main() {
.long("full-paths")
.help("If set sub directories will not have their path shortened"),
)
.arg(
Arg::with_name("ignore_directory")
.short("X")
.long("ignore-directory")
.takes_value(true)
.help("Exclude any file or directory with contains this substring."),
)
.arg(
Arg::with_name("limit_filesystem")
.short("x")
@@ -128,10 +135,12 @@ fn main() {
let use_apparent_size = options.is_present("display_apparent_size");
let limit_filesystem = options.is_present("limit_filesystem");
let ignore_directory = options.value_of("ignore_directory");
let simplified_dirs = simplify_dir_names(target_dirs);
let (permissions, nodes) = get_dir_tree(
&simplified_dirs,
ignore_directory,
use_apparent_size,
limit_filesystem,
threads,