add noop, runqs support to runner

This commit is contained in:
Luna 2020-06-01 22:47:21 -03:00
parent 7f008db540
commit 0453f37305

View file

@ -175,18 +175,19 @@ pub const Runner = struct {
try image.saveTo(out_path);
}
fn runQSCmd(self: *Runner, program: []const u8) !void {
fn runQSCmd(self: *Runner, cmd: lang.Command) !void {
const runqs = cmd.cast(lang.Command.RunQS).?;
var image = try self.getImage();
const out_path = try self.makeGlitchedPath();
try image.saveTo(out_path);
var proc = try std.ChildProcess.init(
&[_][]const u8{ program, out_path },
&[_][]const u8{ runqs.program, out_path },
self.allocator,
);
defer proc.deinit();
std.debug.warn("running '{} {}'\n", .{ program, out_path });
std.debug.warn("running '{} {}'\n", .{ runqs.program, out_path });
_ = try proc.spawnAndWait();
}
@ -249,12 +250,14 @@ pub const Runner = struct {
fn runCommand(self: *@This(), cmd: lang.Command) !void {
switch (cmd.tag) {
.noop => {},
.load => {
const command = cmd.cast(lang.Command.Load).?;
try self.loadCmd(command.path);
},
.quicksave => try self.quicksaveCmd(),
.rotate => try self.rotateCmd(cmd),
.runqs => try self.runQSCmd(cmd),
.amp => try self.runSingleCommand(cmd, .amp),
.rflanger => try self.runSingleCommand(cmd, .rflanger),