Add Hide hidden flag

From feature request to respect the .gitignore file. Decided to bundle in
respect for hidden files into the same feature [otherwise if you obey
the .gitignore file you still endup showing the .git directory]
This commit is contained in:
andy.boot
2020-09-02 22:47:32 +01:00
parent 4e1180e502
commit 873456eb97
2 changed files with 19 additions and 6 deletions
+8
View File
@@ -126,6 +126,12 @@ fn main() {
.long("filecount")
.help("Directory 'size' is number of child files/dirs not disk size"),
)
.arg(
Arg::with_name("ignore_hidden")
.short("i") // Do not use 'h' this is used by 'help'
.long("ignore_hidden")
.help("Obey .git_ignore rules & Do not display hidden files"),
)
.arg(Arg::with_name("inputs").multiple(true))
.get_matches();
@@ -165,6 +171,7 @@ fn main() {
None => None,
};
let by_filecount = options.is_present("by_filecount");
let show_hidden = !options.is_present("ignore_hidden");
let simplified_dirs = simplify_dir_names(target_dirs);
let (permissions, nodes) = get_dir_tree(
@@ -173,6 +180,7 @@ fn main() {
use_apparent_size,
limit_filesystem,
by_filecount,
show_hidden,
depth,
);
let sorted_data = sort(nodes);