Skip to content

Commit

Permalink
hack
Browse files Browse the repository at this point in the history
  • Loading branch information
bootandy committed Aug 30, 2020
1 parent 4ea8d93 commit 4e1180e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Expand Up @@ -30,8 +30,7 @@ unicode-width = "0.1"
ignore="0.4"
crossbeam-channel = "0.4"
walkdir="2.3"
# todo use num_format instead
thousands=""
thousands = "0.2"

[target.'cfg(windows)'.dependencies]
winapi-util = "0.1"
Expand Down
22 changes: 9 additions & 13 deletions src/display.rs
Expand Up @@ -338,26 +338,22 @@ fn get_name_percent(
}

fn get_pretty_size(node: &Node, is_biggest: bool, display_data: &DisplayData) -> String {
if display_data.by_filecount {
let output = if display_data.by_filecount {
let size_as_str = node.size.separate_with_commas();
let spaces_to_add =
display_data.num_chars_needed_on_left_most - size_as_str.chars().count();
let first_size_bar = size_as_str + &*repeat(' ').take(spaces_to_add).collect::<String>();
size_as_str + &*repeat(' ').take(spaces_to_add).collect::<String>()
} else {
format!("{:>5}", human_readable_number(node.size))
};

if is_biggest && display_data.colors_on {
format!("{}", Red.paint(first_size_bar))
} else {
first_size_bar
}
if is_biggest && display_data.colors_on {
format!("{}", Red.paint(output))
} else {
let pretty_size = format!("{:>5}", human_readable_number(node.size));
if is_biggest && display_data.colors_on {
format!("{}", Red.paint(pretty_size))
} else {
pretty_size
}
output
}
}

fn get_pretty_name(node: &Node, name_and_padding: String, display_data: &DisplayData) -> String {
if display_data.colors_on {
let meta_result = fs::metadata(node.name.clone());
Expand Down

1 comment on commit 4e1180e

@bootandy
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was meant to be squashed, hence the bad name

Please sign in to comment.