diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2025-08-14 17:50:42 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2025-08-14 17:53:53 +0200 |
commit | 4dd206a5a3a32e23e05c0842ce4db7a108de4d5f (patch) | |
tree | b83fb3daf371ed53739cefcde1db841df21ca5e4 /src/cmd/pipe.zig | |
parent | 35a3b9ccfeb9dcd2c88c359108305b7f750622d6 (diff) |
Refactor shared eval function parameters into a CommandContext struct.
Diffstat (limited to 'src/cmd/pipe.zig')
-rw-r--r-- | src/cmd/pipe.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cmd/pipe.zig b/src/cmd/pipe.zig index 4f079cb..f97561a 100644 --- a/src/cmd/pipe.zig +++ b/src/cmd/pipe.zig @@ -4,6 +4,7 @@ const print = std.debug.print; const types = @import("./lib/types.zig"); const CommandStatus = types.CommandStatus; +const CommandContext = types.CommandContext; const OutputCapture = types.OutputCapture; const InputSource = types.InputSource; @@ -17,8 +18,11 @@ pub const PipeCommand = struct { left: *Command, right: *Command, - pub fn eval(pipe: PipeCommand, allocator: Allocator, output_capture: ?*OutputCapture, input_source: ?*InputSource, executeCommandWithOutput: ExecuteCommandFn) !CommandStatus { - _ = input_source; // Pipe handles its own input flow + pub fn eval(pipe: PipeCommand, ctx: CommandContext) !CommandStatus { + // Cast the execute function back to its proper type + const executeCommandWithOutput: ExecuteCommandFn = @ptrCast(@alignCast(ctx.execute_command.?)); + const allocator = ctx.allocator; + const output_capture = ctx.output_capture; // Create output capture for the left command var left_output = OutputCapture.init(allocator); |