pull out a method

(will be needed for reverse)
This commit is contained in:
andy.boot
2019-10-02 20:06:09 +01:00
parent 1c60d1e2ac
commit 9fbfcb275a
+14 -3
View File
@@ -54,12 +54,25 @@ fn display_node(
Some(0) => return,
Some(d) => Some(d - 1),
};
match get_size(to_display, node_to_print) {
None => println!("Can not find path: {}", node_to_print),
Some(size) => {
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);
// Annoying edge case for when run on root directory
@@ -88,8 +101,6 @@ fn display_node(
}
}
}
}
}
fn clean_indentation_string(s: &str) -> String {
let mut is :String = s.into();