Pretty Table

Pretty Table

A formatted and aligned table printer library for Zig.

Features

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

Usage

See pretty-table-demo.zig

    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});
┌────────┬─────┐
│Language│Files│
├────────┼─────┤
│Zig     │3    │
│Python  │2    │
│C       │12   │
│Ruby    │5    │
├────────┼─────┤
│Total   │22   │
└────────┴─────┘