feat: expand variables in arguments to filters

This commit is contained in:
CJ van den Berg 2025-12-16 23:08:42 +01:00
parent 4cd9644373
commit 3fdee5e532
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -6229,7 +6229,14 @@ pub const Editor = struct {
} }
pub const filter_meta: Meta = .{ .arguments = &.{.string} }; pub const filter_meta: Meta = .{ .arguments = &.{.string} };
fn filter_cmd(self: *Self, cmd: tp.message) !void { fn filter_cmd(self: *Self, cmd_: tp.message) !void {
const expansion = @import("expansion.zig");
const args = expansion.expand_cbor(self.allocator, cmd_.buf) catch |e| switch (e) {
error.NotFound => return error.Stop,
else => |e_| return e_,
};
const cmd: tp.message = .{ .buf = args };
defer self.allocator.free(args);
if (self.filter_) |_| return error.Stop; if (self.filter_) |_| return error.Stop;
const root = self.buf_root() catch return; const root = self.buf_root() catch return;
const buf_a_ = try self.buf_a(); const buf_a_ = try self.buf_a();