summaryrefslogtreecommitdiff
path: root/src/cmd/remove.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/remove.zig')
-rw-r--r--src/cmd/remove.zig13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/cmd/remove.zig b/src/cmd/remove.zig
index 7b85f1d..e7d2688 100644
--- a/src/cmd/remove.zig
+++ b/src/cmd/remove.zig
@@ -4,15 +4,14 @@ const print = std.debug.print;
const types = @import("./lib/types.zig");
const CommandStatus = types.CommandStatus;
-const OutputCapture = types.OutputCapture;
-const InputSource = types.InputSource;
+const CommandContext = types.CommandContext;
pub const Remove = struct {
path: []const u8,
- pub fn eval(remove: Remove, allocator: Allocator, output_capture: ?*OutputCapture, input_source: ?*InputSource) !CommandStatus {
- _ = allocator;
- _ = input_source;
+ pub fn eval(remove: Remove, ctx: CommandContext) !CommandStatus {
+ _ = ctx.allocator;
+ _ = ctx.input_source;
const file_path = remove.path;
@@ -20,7 +19,7 @@ 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 (output_capture) |capture| {
+ if (ctx.output_capture) |capture| {
try capture.write(error_msg);
} else {
print("{s}", .{error_msg});
@@ -36,7 +35,7 @@ pub const Remove = struct {
error.IsDir => "Access denied - cannot delete directory\n",
else => "Cannot delete file\n",
};
- if (output_capture) |capture| {
+ if (ctx.output_capture) |capture| {
try capture.write(error_msg);
} else {
print("{s}", .{error_msg});