repos / zmx

session persistence for terminal processes
git clone https://github.com/neurosnap/zmx.git

commit
314974e
parent
1dbbe3d
author
Eric Bower
date
2026-01-23 09:45:09 -0500 EST
chore(version): show git sha if running dev build
2 files changed,  +14, -1
M build.zig
+8, -0
 1@@ -19,8 +19,16 @@ pub fn build(b: *std.Build) void {
 2     const run_step = b.step("run", "Run the app");
 3     const test_step = b.step("test", "Run unit tests");
 4 
 5+    var code: u8 = 0;
 6+    const git_sha = std.mem.trim(u8, b.runAllowFail(
 7+        &.{ "git", "rev-parse", "--short", "HEAD" },
 8+        &code,
 9+        .Inherit,
10+    ) catch "unknown", "\n");
11+
12     const options = b.addOptions();
13     options.addOption([]const u8, "version", version);
14+    options.addOption([]const u8, "git_sha", git_sha);
15     options.addOption([]const u8, "ghostty_version", @import("build.zig.zon").dependencies.ghostty.hash);
16 
17     const exe_mod = b.createModule(.{
M src/main.zig
+6, -1
 1@@ -7,6 +7,7 @@ const ipc = @import("ipc.zig");
 2 const log = @import("log.zig");
 3 
 4 pub const version = build_options.version;
 5+pub const git_sha = build_options.git_sha;
 6 pub const ghostty_version = build_options.ghostty_version;
 7 
 8 var log_system = log.LogSystem{};
 9@@ -442,7 +443,11 @@ pub fn main() !void {
10 fn printVersion() !void {
11     var buf: [256]u8 = undefined;
12     var w = std.fs.File.stdout().writer(&buf);
13-    try w.interface.print("zmx {s}\nghostty-vt {s}\n", .{ version, ghostty_version });
14+    var ver = version;
15+    if (builtin.mode == .Debug) {
16+        ver = git_sha;
17+    }
18+    try w.interface.print("zmx {s}\nghostty-vt {s}\n", .{ ver, ghostty_version });
19     try w.interface.flush();
20 }
21