summaryrefslogtreecommitdiff
path: root/src/cmd/rename.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/rename.zig')
-rw-r--r--src/cmd/rename.zig22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/cmd/rename.zig b/src/cmd/rename.zig
index 386e0f7..58a5702 100644
--- a/src/cmd/rename.zig
+++ b/src/cmd/rename.zig
@@ -1,6 +1,5 @@
const std = @import("std");
const Allocator = std.mem.Allocator;
-const print = std.debug.print;
const syntax = @import("../syntax.zig");
const FileSpec = syntax.FileSpec;
@@ -17,11 +16,8 @@ pub const Rename = struct {
const from_path = switch (rename.from) {
.Con, .Lpt1, .Lpt2, .Lpt3, .Prn => {
const error_msg = "Cannot rename device\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 };
},
.Path => |path| path,
@@ -30,11 +26,8 @@ pub const Rename = struct {
const to_path = switch (rename.to) {
.Con, .Lpt1, .Lpt2, .Lpt3, .Prn => {
const error_msg = "Cannot rename to device\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 };
},
.Path => |path| path,
@@ -48,11 +41,8 @@ pub const Rename = struct {
error.RenameAcrossMountPoints => "Cannot rename across different drives\n",
else => "Cannot rename 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 };
};