diff options
Diffstat (limited to 'src/cmd/dir.zig')
-rw-r--r-- | src/cmd/dir.zig | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/cmd/dir.zig b/src/cmd/dir.zig index 27d0e30..ffb38e2 100644 --- a/src/cmd/dir.zig +++ b/src/cmd/dir.zig @@ -1,7 +1,6 @@ const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; -const print = std.debug.print; const c = @cImport({ @cInclude("errno.h"); @@ -138,11 +137,8 @@ pub const Dir = struct { var dir_iterator = std.fs.cwd().openDir(dir.path, .{ .iterate = true }) catch { const error_msg = "File not found\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 }; }; defer dir_iterator.close(); @@ -226,11 +222,8 @@ pub const Dir = struct { try output_buffer.writer().print(" {d} Dir(s) {s:>14} bytes free\n", .{ dir_count, formatted_free_bytes }); } - if (ctx.output_capture) |capture| { - try capture.write(output_buffer.items); - } else { - print("{s}", .{output_buffer.items}); - } + var writer = ctx.output_writer; + try writer.write(output_buffer.items); return CommandStatus{ .Code = 0 }; } }; |