add(examples/errors): error notifaction handling
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m33s

This commit is contained in:
2025-02-21 22:25:42 +01:00
parent 9b0dd3c52f
commit dab486a2c1
2 changed files with 166 additions and 0 deletions

View File

@@ -17,6 +17,8 @@ pub fn build(b: *std.Build) void {
// styles:
text,
palette,
// error handling
errors,
};
const example = b.option(Examples, "example", "Example to build and/or run. (default: vertical)") orelse .vertical;
@@ -115,6 +117,15 @@ pub fn build(b: *std.Build) void {
});
text.root_module.addImport("zterm", lib);
// error handling:
const errors = b.addExecutable(.{
.name = "errors",
.root_source_file = b.path("examples/errors.zig"),
.target = target,
.optimize = optimize,
});
errors.root_module.addImport("zterm", lib);
// mapping of user selected example to compile step
const exe = switch (example) {
// elements:
@@ -129,6 +140,8 @@ pub fn build(b: *std.Build) void {
// styles:
.text => text,
.palette => palette,
// error handling:
.errors => errors,
};
b.installArtifact(exe);