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/remove.zig | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/cmd/remove.zig') diff --git a/src/cmd/remove.zig b/src/cmd/remove.zig index ba59504..8cf52b3 100644 --- a/src/cmd/remove.zig +++ b/src/cmd/remove.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; @@ -16,11 +15,8 @@ pub const Remove = struct { if (std.mem.indexOf(u8, file_path, "*") != null or std.mem.indexOf(u8, file_path, "?") != null) { // Simple wildcard deletion - just show error for now const error_msg = "Wildcard deletion not yet implemented\n"; - if (ctx.output_capture) |capture| { - try capture.write(error_msg); - } else { - print("{s}", .{error_msg}); - } + var writer = ctx.output_writer; + try writer.write(error_msg); return CommandStatus{ .Code = 1 }; } @@ -32,11 +28,8 @@ pub const Remove = struct { error.IsDir => "Access denied - cannot delete directory\n", else => "Cannot delete file\n", }; - if (ctx.output_capture) |capture| { - try capture.write(error_msg); - } else { - print("{s}", .{error_msg}); - } + var writer = ctx.output_writer; + try writer.write(error_msg); return CommandStatus{ .Code = 1 }; }; -- cgit v1.2.1