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

Function tree_prefix

atomic-cli/src/commands/view/list.rs:353–363  ·  view source on GitHub ↗

The tree prefix for a line at the given depth. Roots start at column 0 (`dev`, or `* dev` when current); children are indented two spaces per level with a `- ` bullet (` - baby-bird-123`).

(entry: &ViewEntry, depth: usize)

Source from the content-addressed store, hash-verified

351/// Roots start at column 0 (`dev`, or `* dev` when current); children are
352/// indented two spaces per level with a `- ` bullet (` - baby-bird-123`).
353fn tree_prefix(entry: &ViewEntry, depth: usize) -> String {
354 match depth {
355 0 if entry.is_current => "* ".to_string(),
356 0 => String::new(),
357 _ => format!(
358 "{}- {}",
359 " ".repeat(depth),
360 if entry.is_current { "* " } else { "" }
361 ),
362 }
363}
364
365/// Render one view line for the default (metadata) mode.
366pub(crate) fn render_line(entry: &ViewEntry, depth: usize, width: usize) -> String {

Callers 1

render_lineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected