e0aef3b8a987
status: show home manager generation when HM is installed — homeStatusLine adds a dim 'hm gen <n> <date>' row indented under the machine rows, gated on standalone HM detection so a machine without home-manager shows nothing (verified: no hm line on a no-HM host); statusCmd no longer early-returns on --all so the hm line renders in both modes; build+tests green
- time
- 2026-06-10 01:29 UTC · 4 months ago
- machine
- koh2
- agent
- claude-opus-4-8
- session
- flake + home manager support
- parent
- e0ee1531cdef
↓ nina-e0aef3b8.tar.gzatlas at this save
files changed2 files
src/commands.zig+16 −2src/output.zig+10 −0src/commands.zig+16 −2
@@ -187,9 +187,23 @@187187 // path as exec.capture. An unreachable machine is shown in red, not fatal.188188 if (ctx.all and ctx.cfg.machines.len > 0) {189189 for (ctx.cfg.machines) |m| statusRowFor(ctx, &m);190- return;190+ } else {191+ statusRowFor(ctx, &ctx.machine);191192 }192- statusRowFor(ctx, &ctx.machine);193+ homeStatusLine(ctx);194+}195+196+// When standalone Home Manager is present, show its current generation as a dim197+// line indented under the machine rows. Gated on standalone mode (the only mode198+// where we can read a generation), so a machine without HM is unaffected.199+fn homeStatusLine(ctx: Ctx) void {200+ if (exec.detectHomeManager(ctx.gpa, ctx.io, ctx.environ) != .standalone) return;201+ const out = exec.homeGenerations(ctx.gpa, ctx.io, &ctx.machine) catch return;202+ defer ctx.gpa.free(out);203+ const gens = parseHomeGenerations(ctx.gpa, out) catch return;204+ defer freeHomeGens(ctx.gpa, gens);205+ if (gens.len == 0) return;206+ output.statusHomeRow(gens[0].number, gens[0].date);193207 }194208 195209 fn statusRowFor(ctx: Ctx, machine: *const types.Machine) void {src/output.zig+10 −0
@@ -304,6 +304,16 @@304304 }305305 }306306 307+// Dim Home Manager generation line, indented under the machine row. Only shown308+// when standalone HM is detected; absent otherwise so the layout is unchanged.309+pub fn statusHomeRow(gen: u32, detail: []const u8) void {310+ if (detail.len > 0) {311+ p(" {s} hm gen {d} {s}{s}\n", .{ c(DIM), gen, detail, c(RESET) });312+ } else {313+ p(" {s} hm gen {d}{s}\n", .{ c(DIM), gen, c(RESET) });314+ }315+}316+307317 // --- Diff ---308318 309319 pub fn diffHeader(a: u32, b: u32, machine: []const u8) void {