summaryrefslogtreecommitdiff
path: root/src/cmd/sort.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/sort.zig')
-rw-r--r--src/cmd/sort.zig15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/cmd/sort.zig b/src/cmd/sort.zig
index 8b797d1..0f73940 100644
--- a/src/cmd/sort.zig
+++ b/src/cmd/sort.zig
@@ -1,7 +1,6 @@
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
-const print = std.debug.print;
const types = @import("./lib/types.zig");
const CommandStatus = types.CommandStatus;
@@ -28,11 +27,8 @@ pub const Sort = struct {
} else {
// Read from stdin (simplified - just show message)
const msg = "SORT: Use input redirection (< file.txt) to sort file contents\n";
- if (ctx.output_capture) |capture| {
- try capture.write(msg);
- } else {
- print("{s}", .{msg});
- }
+ var writer = ctx.output_writer;
+ try writer.write(msg);
return CommandStatus{ .Code = 0 };
}
@@ -51,11 +47,8 @@ pub const Sort = struct {
try output_buffer.writer().print("{s}\n", .{line});
}
- 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 };
}