lil-tabby 0.1.2

A macro-based library for creating visually appealing tables with automatic column spanning
Documentation
# lil-tabby 🐱‍💻

[![Crates.io](https://img.shields.io/crates/v/lil-tabby.svg)](https://crates.io/crates/lil-tabby)
[![Documentation](https://docs.rs/lil-tabby/badge.svg)](https://docs.rs/lil-tabby)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Build Status](https://github.com/ivs-ug/lil-tabby/workflows/CI/badge.svg)](https://github.com/ivs-ug/lil-tabby/actions)

A lightweight Rust macro for building beautiful terminal tables — with **automatic column spanning**, **header handling**, and **colorful styling** — all powered by [`tabled`](https://github.com/zhiburt/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 `tabled` for advanced tweaks.
- **Zero Boilerplate** — Just `tabby![]` and go.

## Installation

**Add to your `Cargo.toml`:**

```toml
[dependencies]
lil-tabby = "0.1.2"
```

## Usage

### Basic Table (Inline)

```rust
use lil_tabby::tabby;

let table = tabby![
    { style: ascii }
    ["Name", "Type"],
    ["Some", "Field"],
    ["Above", "Will", "Span"]
];
println!("{}", table);
```

**Output:**

```text
+-------+-------------+
| Name  | Type        |
+-------+-------------+
| Some  | Field       |
+-------+------+------+
| Above | Will | Span |
+-------+------+------+
```

### Styled Table with Options

```rust
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>>`

```rust
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:**

```rust
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:**

```text
+---+---+---+
| 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:

```rust
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 `tabled` color names (e.g., `bright_green`, not `lime`).

## 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.