feat: add support for command metadata
This commit is contained in:
parent
6b43dd4f28
commit
bdd16f43fb
6 changed files with 77 additions and 42 deletions
|
@ -223,9 +223,12 @@ fn receive_safe(self: *Self, from: tp.pid_ref, m: tp.message) !void {
|
|||
return;
|
||||
|
||||
var cmd: []const u8 = undefined;
|
||||
var cmd_id: command.ID = undefined;
|
||||
var ctx: cmds.Ctx = .{};
|
||||
if (try m.match(.{ "cmd", tp.extract(&cmd) }))
|
||||
return command.executeName(cmd, ctx) catch |e| self.logger.err(cmd, e);
|
||||
if (try m.match(.{ "cmd", tp.extract(&cmd_id) }))
|
||||
return command.execute(cmd_id, ctx) catch |e| self.logger.err("command", e);
|
||||
|
||||
var arg: []const u8 = undefined;
|
||||
|
||||
|
@ -233,6 +236,10 @@ fn receive_safe(self: *Self, from: tp.pid_ref, m: tp.message) !void {
|
|||
ctx.args = .{ .buf = arg };
|
||||
return command.executeName(cmd, ctx) catch |e| self.logger.err(cmd, e);
|
||||
}
|
||||
if (try m.match(.{ "cmd", tp.extract(&cmd_id), tp.extract_cbor(&arg) })) {
|
||||
ctx.args = .{ .buf = arg };
|
||||
return command.execute(cmd_id, ctx) catch |e| self.logger.err("command", e);
|
||||
}
|
||||
if (try m.match(.{"quit"})) {
|
||||
project_manager.shutdown();
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue