Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ fn main() {
.long("no-percent-bars")
.help("No percent bars or percentages will be displayed"),
)
.arg(
Arg::with_name("quantity")
.short("q")
.long("quantity")
.help("Measure directories by the quantity of the files, ignoring their size"),
)
.arg(Arg::with_name("inputs").multiple(true))
.get_matches();

Expand Down Expand Up @@ -151,6 +157,7 @@ fn main() {
}

let no_colors = init_color(options.is_present("no_colors"));
let quantity = options.is_present("quantity");
let use_apparent_size = options.is_present("display_apparent_size");
let limit_filesystem = options.is_present("limit_filesystem");
let ignore_directories = match options.values_of("ignore_directory") {
Expand All @@ -165,6 +172,7 @@ fn main() {
use_apparent_size,
limit_filesystem,
depth,
quantity,
);
let sorted_data = sort(nodes);
let biggest_ones = {
Expand Down
2 changes: 2 additions & 0 deletions src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ pub fn get_dir_tree<P: AsRef<Path>>(
apparent_size: bool,
limit_filesystem: bool,
max_depth: Option<usize>,
quantity: bool,
) -> (bool, HashMap<PathBuf, u64>) {
let (tx, rx) = channel::bounded::<PathData>(1000);

Expand Down Expand Up @@ -145,6 +146,7 @@ pub fn get_dir_tree<P: AsRef<Path>>(
match maybe_size_and_inode {
Some(data) => {
let (size, inode_device) = data;
let size = if quantity {1} else {size};
txc.send((p.into_path(), size, inode_device)).unwrap();
}
None => {
Expand Down