pretty#
A compile-time pretty printer for Zig with colored terminal output.
Installation#
Run:
zig fetch --save git+https://git.sr.ht/~altagos/pretty#main
Or manually add to build.zig.zon:
.dependencies = .{
.pretty = .{
.url = "git+https://git.sr.ht/~altagos/pretty#main",
.hash = "<HASH>",
},
}
In build.zig:
const pretty = b.dependency("pretty", .{ .target = target, .optimize = optimize });
exe.root_module.addImport("pretty", pretty.module("pretty"));
Usage#
For a detailed example, see example/main
const pretty = @import("pretty").pretty;
std.debug.print("{f}\n", .{pretty(my_value)});
With Options#
const prettyO = @import("pretty").prettyO;
std.debug.print("{f}\n", .{prettyO(my_value, .{
.struct_inline = true,
.array_inline = true,
})});
Global Defaults#
pub const pretty_options = @import("pretty").Options{
.skip_root_type_name = true,
.theme = .{ .indent_width = 4 },
};