blob: c9840671313d922014b99575cebb1df00d6cb1b2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
const std = @import("std");
const cli = @import("cli.zig");
const global = @import("../global.zig");
const log = std.log.scoped(.benchmark);
/// Run the Ghostty benchmark CLI with the given action and arguments.
export fn ghostty_benchmark_cli(
action_name_: [*:0]const u8,
args: [*:0]const u8,
) bool {
const action_name = std.mem.sliceTo(action_name_, 0);
const action: cli.Action = std.meta.stringToEnum(
cli.Action,
action_name,
) orelse {
log.warn("unknown action={s}", .{action_name});
return false;
};
cli.mainAction(
global.alloc(),
action,
.{ .string = std.mem.sliceTo(args, 0) },
) catch |err| {
log.warn("failed to run action={s} err={}", .{
@tagName(action),
err,
});
return false;
};
return true;
}
|