MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / path_nodes

Function path_nodes

atomic-cli/src/commands/change/tree.rs:291–316  ·  view source on GitHub ↗
(paths: PathTree, show_hunks: bool)

Source from the content-addressed store, hash-verified

289}
290
291fn path_nodes(paths: PathTree, show_hunks: bool) -> Vec<Tree> {
292 paths
293 .children
294 .into_iter()
295 .map(|(name, path)| {
296 let slash = if path.directory || !path.children.is_empty() {
297 "/"
298 } else {
299 ""
300 };
301 let badge = path
302 .summary
303 .as_ref()
304 .map(|summary| format!(" [{}]", status(summary.symbol)))
305 .unwrap_or_default();
306 let mut node = Tree::new(format!("{name}{slash}{badge}"));
307 if show_hunks {
308 if let Some(summary) = &path.summary {
309 node.push(summary.info.trim_start_matches('(').trim_end_matches(')'));
310 }
311 }
312 node.children.extend(path_nodes(path, show_hunks));
313 node
314 })
315 .collect()
316}
317
318fn status(symbol: &str) -> &str {
319 match symbol {

Callers 1

filesFunction · 0.85

Calls 6

as_refMethod · 0.80
extendMethod · 0.80
collectMethod · 0.45
into_iterMethod · 0.45
is_emptyMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected