MCPcopy Create free account
hub / github.com/ccusage/ccusage / pad_cell

Function pad_cell

rust/crates/ccusage-terminal/src/table.rs:358–368  ·  view source on GitHub ↗
(cell: &str, width: usize, align: Align)

Source from the content-addressed store, hash-verified

356}
357
358fn pad_cell(cell: &str, width: usize, align: Align) -> String {
359 let visible = visible_width(cell);
360 if visible >= width {
361 return cell.to_string();
362 }
363 let padding = width - visible;
364 match align {
365 Align::Left => format!("{cell}{}", " ".repeat(padding)),
366 Align::Right => format!("{}{cell}", " ".repeat(padding)),
367 }
368}
369
370fn border(left: char, middle: char, right: char, widths: &[usize]) -> String {
371 let mut line = String::new();

Callers 1

table_lineFunction · 0.85

Calls 1

visible_widthFunction · 0.85

Tested by

no test coverage detected