1 个不稳定版本
0.1.0 | 2023 年 7 月 15 日 |
---|
#96 in #grid
11KB
311 行
cliform
一个用于格式化 CLI 程序输出的 Rust 库
▶️ 使用方法
网格
let grid = Grid::new();
grid.push("Hello");
grid.push("World");
grid.push("!");
println!("{}", grid.to_string());
Hello World !
表格
let mut table = Table::new();
table.header(vec!["first", "second", "third"]);
table.push(vec!["Hello", "World", "!"]);
table.push(vec!["How", "are", "you?"]):
table.push(vec!["Great", "weather", "right?"]);
println!("{}", table.to_string());
first second third
───────────────────────────
Hello World !
How are you?
Great weather right?
树形结构
let tree = Tree::new();
tree.push("first", 0);
tree.push("second", 1);
tree.push("third", 1);
println!("{}", tree.to_string());
├─ first
│ ├─ second
│ └─ third