38ab7ce66df4
polish list system versions — strip nix multi-output suffixes (-bin/-man/-dev/...) so the version column reads clean (curl 8.20.0 not 8.20.0-bin); verified on kyoshi: less 692, openssh 10.3p1; build+tests green incl suffix test
- time
- 2026-06-05 02:28 UTC · 4 months ago
- machine
- koh2
- agent
- claude-opus-4-8
- session
- nina finishing brief
- parent
- 9b54f69bee5a
↓ nina-38ab7ce6.tar.gzatlas at this save
files changed1 file
src/commands.zig+17 −1src/commands.zig+17 −1
@@ -684,12 +684,23 @@684684 var i: usize = 0;685685 while (i + 1 < after_hash.len) : (i += 1) {686686 if (after_hash[i] == '-' and std.ascii.isDigit(after_hash[i + 1])) {687- return .{ .name = after_hash[0..i], .version = after_hash[i + 1 ..] };687+ return .{ .name = after_hash[0..i], .version = stripOutputSuffix(after_hash[i + 1 ..]) };688688 }689689 }690690 return .{ .name = after_hash, .version = "" };691691 }692692 693+// Multi-output derivations append the output name to the store path (e.g.694+// curl-8.20.0-bin, less-692-man). Strip that suffix so the version column reads695+// as just the version.696+fn stripOutputSuffix(ver: []const u8) []const u8 {697+ const suffixes = [_][]const u8{ "-bin", "-man", "-dev", "-doc", "-lib", "-info", "-out", "-static", "-devdoc" };698+ for (suffixes) |s| {699+ if (std.mem.endsWith(u8, ver, s)) return ver[0 .. ver.len - s.len];700+ }701+ return ver;702+}703+693704 test "pkgFromStorePath splits name and version at first dash-digit" {694705 const a = pkgFromStorePath("/nix/store/abcdefghijklmnopqrstuvwxyz012345-ripgrep-15.1.0");695706 try std.testing.expectEqualStrings("ripgrep", a.name);@@ -698,6 +709,11 @@698709 const b = pkgFromStorePath("/nix/store/abcdefghijklmnopqrstuvwxyz012345-helix-25.01");699710 try std.testing.expectEqualStrings("helix", b.name);700711 try std.testing.expectEqualStrings("25.01", b.version);712+713+ // multi-output store paths drop their output-name suffix714+ const c = pkgFromStorePath("/nix/store/abcdefghijklmnopqrstuvwxyz012345-curl-8.20.0-bin");715+ try std.testing.expectEqualStrings("curl", c.name);716+ try std.testing.expectEqualStrings("8.20.0", c.version);701717 }702718 703719 fn firstStorePath(el: std.json.Value) ?[]const u8 {