From 9edc1338b92d1ead4c5f2fad8c0516037963f7b6 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 16 Aug 2025 12:50:23 +0200 Subject: Unify output handling. Now every command always uses an OutputWriter instead of conditionally writing directly to stdout using std.debug.print. --- src/cmd/time.zig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/cmd/time.zig') diff --git a/src/cmd/time.zig b/src/cmd/time.zig index c30ca47..5c86b49 100644 --- a/src/cmd/time.zig +++ b/src/cmd/time.zig @@ -1,6 +1,5 @@ const std = @import("std"); const Allocator = std.mem.Allocator; -const print = std.debug.print; const types = @import("./lib/types.zig"); const CommandStatus = types.CommandStatus; @@ -19,11 +18,8 @@ pub const Time = struct { const output = try std.fmt.allocPrint(ctx.allocator, "Current time is {d:0>2}:{d:0>2}:{d:0>2}\n", .{ hours, minutes, seconds }); defer ctx.allocator.free(output); - if (ctx.output_capture) |capture| { - try capture.write(output); - } else { - print("{s}", .{output}); - } + var writer = ctx.output_writer; + try writer.write(output); return CommandStatus{ .Code = 0 }; } }; -- cgit v1.2.1