3 releases
Uses new Rust 2024
| 0.1.2 | Aug 23, 2025 |
|---|---|
| 0.1.1 | Aug 23, 2025 |
| 0.1.0 | Aug 23, 2025 |
#718 in Text processing
31 downloads per month
Used in pump-dump
21KB
292 lines
lil-tabby 🐱💻
A lightweight Rust macro for building beautiful terminal tables — with automatic column spanning, header handling, and colorful styling — all powered by tabled.
Perfect for CLI tools, inspectors, and any app that needs clean, readable terminal output.
Features
- Auto Column Spanning — Short rows automatically span to fill width.
- First Row as Header — Or data. No extra config needed.
- Rich Styling — Customize style, colors, borders, and bold headers.
- Two Syntaxes — Inline literals or from
Vec<Vec<String>>. - Extensible — Re-exports
tabledfor advanced tweaks. - Zero Boilerplate — Just
tabby![]and go.
Installation
Add to your Cargo.toml:
[dependencies]
lil-tabby = "0.1.2"
Usage
Basic Table (Inline)
use lil_tabby::tabby;
let table = tabby![
{ style: ascii }
["Name", "Type"],
["Some", "Field"],
["Above", "Will", "Span"]
];
println!("{}", table);
Output:
+-------+-------------+
| Name | Type |
+-------+-------------+
| Some | Field |
+-------+------+------+
| Above | Will | Span |
+-------+------+------+
Styled Table with Options
use lil_tabby::tabby;
let table = tabby![
{ style: modern_rounded, header: green, labels: yellow, color: blue, border: red, bold: true }
["Package", "Version"],
["tokio", "1.0"],
["serde", "1.0", "active"]
];
println!("{}", table);
From Vec<Vec<String>>
use lil_tabby::tabby;
let data: Vec<Vec<String>> = vec![
vec!["Header 1".to_string(), "Header 2".to_string(), "Header 3".to_string()],
vec!["Row 1".to_string()],
vec!["Row 2 Col 1".to_string(), "Row 2 Col 2".to_string()]
];
println!("{}", tabby!(data));
Post-Creation Modification
tabled re-export:
use lil_tabby::{tabby, tabled};
let mut table = tabby![
{ style: ascii, border: bright_green }
["a", "b", "c"],
["d", "e"],
["f"]
];
// Align all columns to the right
table.with(tabled::settings::Alignment::right());
println!("{}", table);
Output:
+---+---+---+
| a | b | c |
+---+---+---+
| d | e |
+---+-------+
| f |
+-----------+
Styling Options
The optional { ... } block supports:
| Option | Values | Default | Maps To |
|---|---|---|---|
style |
modern_rounded, ascii, ... |
modern_rounded |
Style::... |
header |
red, green, bright_black, ... |
white |
FG_COLOR |
labels |
same as above | white |
First column |
color |
same as above | white |
Content cells |
border |
same as above | bright_black |
Border lines |
bold |
true / false |
false |
Header bolding |
Color names match
tabled::settings::Color::FG_*(lower-case in macro).
Example:
tabby![
{ style: ascii, header: bright_yellow, color: blue, border: red, bold: true }
["some", "data"]
]
Limitations
- Max 20 columns (due to const generic limits in
tabled).
→ Anyway, won't fit the screen. Like 640kb, should be enough. - Colors must be mapped to valid
tabledcolor names (e.g.,bright_green, notlime).
Why This Exists
tabled is powerful, but awkward for quick CLI tables:
- No easy header handling
- Manual spanning
- Repetitive styling
License
MIT — Do whatever you want. Credit appreciated, not required.
Dependencies
~4MB
~73K SLoC