pretty-table

Print aligned and formatted tables

Features

  • Many box-drawing character to choose(ascii, box, dos).

Usage

See pretty-table-demo.zig

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    const t = Table(2){
        .header = [_]String{ "Language", "Files" },
        .rows = &[_][2]String{
            .{ "Zig", "3" },
            .{ "Python", "2" },
        },
        .footer = [2]String{ "Total", "5" },
        .mode = .box, // or .ascii, .dos
    };

    const out = std.io.getStdOut();
    try out.writer().print("{}", .{t});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
┌────────┬─────┐
│Language│Files│
├────────┼─────┤
│Zig     │3    │
│Python  │2    │
│C       │12   │
│Ruby    │5    │
├────────┼─────┤
│Total   │22   │
└────────┴─────┘
Last modified September 28, 2024: refactor zip file directory structure (9e01903)