kioz-wang/zterm
A Zig implementation of console_codes (4). Let's start to print colorful message anywhere!
A Zig implementation of console_codes (4).
print
call
NO_COLOR
support
Accept intput
Get display size, get mouse position
Get the latest version:
zig fetch --save git+https://github.com/kioz-wang/zterm
To fetch a specific version (e.g., v0.14.1
):
zig fetch --save https://github.com/kioz-wang/zterm/archive/refs/tags/v0.14.1.tar.gz
The version number follows the format vx.y.z
:
vx.14.z
supports Zig 0.14.0.Use addImport
in your build.zig
(e.g.):
const exe_mod = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
exe_mod.addImport("zterm", b.dependency("zterm", .{}).module("zterm"));
const exe = b.addExecutable(.{
.name = "your_app_name",
.root_module = exe_mod,
});
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
After importing the zterm
, you could get a terminal applied stdout
by:
const zterm = @import("zterm").stdout();
See https://kioz-wang.github.io/zterm/#doc
Welcome to submit PRs to link your project that use
zterm
!
More real-world examples are coming!
MIT © Kioz Wang