mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
pull out a method
(will be needed for reverse)
This commit is contained in:
+14
-3
@@ -54,12 +54,25 @@ fn display_node(
|
|||||||
Some(0) => return,
|
Some(0) => return,
|
||||||
Some(d) => Some(d - 1),
|
Some(d) => Some(d - 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
match get_size(to_display, node_to_print) {
|
match get_size(to_display, node_to_print) {
|
||||||
None => println!("Can not find path: {}", node_to_print),
|
None => println!("Can not find path: {}", node_to_print),
|
||||||
Some(size) => {
|
Some(size) => {
|
||||||
print_this_node(node_to_print, size, is_biggest, short_paths, indentation_str);
|
print_this_node(node_to_print, size, is_biggest, short_paths, indentation_str);
|
||||||
let new_indent = clean_indentation_string(indentation_str);
|
fan_out(node_to_print, found, to_display, short_paths, new_depth, indentation_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn fan_out(
|
||||||
|
node_to_print: &str,
|
||||||
|
found: &mut HashSet<String>,
|
||||||
|
to_display: &[(String, u64)],
|
||||||
|
short_paths: bool,
|
||||||
|
new_depth: Option<u64>,
|
||||||
|
indentation_str: &str,
|
||||||
|
) {
|
||||||
|
let new_indent = clean_indentation_string(indentation_str);
|
||||||
let ntp_with_slash = strip_end_slash(node_to_print);
|
let ntp_with_slash = strip_end_slash(node_to_print);
|
||||||
|
|
||||||
// Annoying edge case for when run on root directory
|
// Annoying edge case for when run on root directory
|
||||||
@@ -88,8 +101,6 @@ fn display_node(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn clean_indentation_string(s: &str) -> String {
|
fn clean_indentation_string(s: &str) -> String {
|
||||||
let mut is :String = s.into();
|
let mut is :String = s.into();
|
||||||
|
|||||||
Reference in New Issue
Block a user