Skip to content

Commit aca64ee

Browse files
Uniformize calling name conventions
Signed-off-by: Francis Bouvier <[email protected]>
1 parent 0f8b47b commit aca64ee

File tree

9 files changed

+38
-39
lines changed

9 files changed

+38
-39
lines changed

src/cdp/browser.zig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const cdp = @import("cdp.zig");
66
const result = cdp.result;
77
const getMsg = cdp.getMsg;
88

9-
const BrowserMethods = enum {
9+
const Methods = enum {
1010
getVersion,
1111
setDownloadBehavior,
1212
getWindowForTarget,
@@ -20,11 +20,11 @@ pub fn browser(
2020
scanner: *std.json.Scanner,
2121
ctx: *Ctx,
2222
) ![]const u8 {
23-
const method = std.meta.stringToEnum(BrowserMethods, action) orelse
23+
const method = std.meta.stringToEnum(Methods, action) orelse
2424
return error.UnknownMethod;
2525
return switch (method) {
26-
.getVersion => browserGetVersion(alloc, id, scanner, ctx),
27-
.setDownloadBehavior => browserSetDownloadBehavior(alloc, id, scanner, ctx),
26+
.getVersion => getVersion(alloc, id, scanner, ctx),
27+
.setDownloadBehavior => setDownloadBehavior(alloc, id, scanner, ctx),
2828
.getWindowForTarget => getWindowForTarget(alloc, id, scanner, ctx),
2929
.setWindowBounds => setWindowBounds(alloc, id, scanner, ctx),
3030
};
@@ -36,7 +36,7 @@ const Revision = "@9e6ded5ac1ff5e38d930ae52bd9aec09bd1a68e4";
3636
const UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
3737
const JsVersion = "12.4.254.8";
3838

39-
fn browserGetVersion(
39+
fn getVersion(
4040
alloc: std.mem.Allocator,
4141
id: ?u16,
4242
scanner: *std.json.Scanner,
@@ -62,7 +62,7 @@ fn browserGetVersion(
6262
return result(alloc, id orelse msg.id.?, Res, res, null);
6363
}
6464

65-
fn browserSetDownloadBehavior(
65+
fn setDownloadBehavior(
6666
alloc: std.mem.Allocator,
6767
id: ?u16,
6868
scanner: *std.json.Scanner,

src/cdp/emulation.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const result = cdp.result;
77
const getMsg = cdp.getMsg;
88
const stringify = cdp.stringify;
99

10-
const EmulationMethods = enum {
10+
const Methods = enum {
1111
setEmulatedMedia,
1212
setFocusEmulationEnabled,
1313
setDeviceMetricsOverride,
@@ -21,7 +21,7 @@ pub fn emulation(
2121
scanner: *std.json.Scanner,
2222
ctx: *Ctx,
2323
) ![]const u8 {
24-
const method = std.meta.stringToEnum(EmulationMethods, action) orelse
24+
const method = std.meta.stringToEnum(Methods, action) orelse
2525
return error.UnknownMethod;
2626
return switch (method) {
2727
.setEmulatedMedia => setEmulatedMedia(alloc, id, scanner, ctx),

src/cdp/fetch.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const cdp = @import("cdp.zig");
66
const result = cdp.result;
77
const getMsg = cdp.getMsg;
88

9-
const FetchMethods = enum {
9+
const Methods = enum {
1010
disable,
1111
};
1212

@@ -17,15 +17,15 @@ pub fn fetch(
1717
scanner: *std.json.Scanner,
1818
ctx: *Ctx,
1919
) ![]const u8 {
20-
const method = std.meta.stringToEnum(FetchMethods, action) orelse
20+
const method = std.meta.stringToEnum(Methods, action) orelse
2121
return error.UnknownMethod;
2222

2323
return switch (method) {
24-
.disable => fetchDisable(alloc, id, scanner, ctx),
24+
.disable => disable(alloc, id, scanner, ctx),
2525
};
2626
}
2727

28-
fn fetchDisable(
28+
fn disable(
2929
alloc: std.mem.Allocator,
3030
id: ?u16,
3131
scanner: *std.json.Scanner,

src/cdp/log.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const result = cdp.result;
77
const getMsg = cdp.getMsg;
88
const stringify = cdp.stringify;
99

10-
const LogMethods = enum {
10+
const Methods = enum {
1111
enable,
1212
};
1313

@@ -18,15 +18,15 @@ pub fn log(
1818
scanner: *std.json.Scanner,
1919
ctx: *Ctx,
2020
) ![]const u8 {
21-
const method = std.meta.stringToEnum(LogMethods, action) orelse
21+
const method = std.meta.stringToEnum(Methods, action) orelse
2222
return error.UnknownMethod;
2323

2424
return switch (method) {
25-
.enable => logEnable(alloc, id, scanner, ctx),
25+
.enable => enable(alloc, id, scanner, ctx),
2626
};
2727
}
2828

29-
fn logEnable(
29+
fn enable(
3030
alloc: std.mem.Allocator,
3131
id: ?u16,
3232
scanner: *std.json.Scanner,

src/cdp/network.zig

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ const Ctx = server.Cmd;
55
const cdp = @import("cdp.zig");
66
const result = cdp.result;
77
const getMsg = cdp.getMsg;
8-
const stringify = cdp.stringify;
98

10-
const NetworkMethods = enum {
9+
const Methods = enum {
1110
enable,
1211
setCacheDisabled,
1312
};
@@ -19,16 +18,16 @@ pub fn network(
1918
scanner: *std.json.Scanner,
2019
ctx: *Ctx,
2120
) ![]const u8 {
22-
const method = std.meta.stringToEnum(NetworkMethods, action) orelse
21+
const method = std.meta.stringToEnum(Methods, action) orelse
2322
return error.UnknownMethod;
2423

2524
return switch (method) {
26-
.enable => networkEnable(alloc, id, scanner, ctx),
27-
.setCacheDisabled => networkSetCacheDisabled(alloc, id, scanner, ctx),
25+
.enable => enable(alloc, id, scanner, ctx),
26+
.setCacheDisabled => setCacheDisabled(alloc, id, scanner, ctx),
2827
};
2928
}
3029

31-
fn networkEnable(
30+
fn enable(
3231
alloc: std.mem.Allocator,
3332
id: ?u16,
3433
scanner: *std.json.Scanner,
@@ -39,7 +38,7 @@ fn networkEnable(
3938
return result(alloc, id orelse msg.id.?, null, null, msg.sessionID);
4039
}
4140

42-
fn networkSetCacheDisabled(
41+
fn setCacheDisabled(
4342
alloc: std.mem.Allocator,
4443
id: ?u16,
4544
scanner: *std.json.Scanner,

src/cdp/page.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const sendEvent = cdp.sendEvent;
1010

1111
const Runtime = @import("runtime.zig");
1212

13-
const PageMethods = enum {
13+
const Methods = enum {
1414
enable,
1515
getFrameTree,
1616
setLifecycleEventsEnabled,
@@ -26,7 +26,7 @@ pub fn page(
2626
scanner: *std.json.Scanner,
2727
ctx: *Ctx,
2828
) ![]const u8 {
29-
const method = std.meta.stringToEnum(PageMethods, action) orelse
29+
const method = std.meta.stringToEnum(Methods, action) orelse
3030
return error.UnknownMethod;
3131
return switch (method) {
3232
.enable => enable(alloc, id, scanner, ctx),

src/cdp/performance.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const cdp = @import("cdp.zig");
66
const result = cdp.result;
77
const getMsg = cdp.getMsg;
88

9-
const PerformanceMethods = enum {
9+
const Methods = enum {
1010
enable,
1111
};
1212

@@ -17,15 +17,15 @@ pub fn performance(
1717
scanner: *std.json.Scanner,
1818
ctx: *Ctx,
1919
) ![]const u8 {
20-
const method = std.meta.stringToEnum(PerformanceMethods, action) orelse
20+
const method = std.meta.stringToEnum(Methods, action) orelse
2121
return error.UnknownMethod;
2222

2323
return switch (method) {
24-
.enable => performanceEnable(alloc, id, scanner, ctx),
24+
.enable => enable(alloc, id, scanner, ctx),
2525
};
2626
}
2727

28-
fn performanceEnable(
28+
fn enable(
2929
alloc: std.mem.Allocator,
3030
id: ?u16,
3131
scanner: *std.json.Scanner,

src/cdp/runtime.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const result = cdp.result;
99
const getMsg = cdp.getMsg;
1010
const stringify = cdp.stringify;
1111

12-
const RuntimeMethods = enum {
12+
const Methods = enum {
1313
enable,
1414
runIfWaitingForDebugger,
1515
evaluate,
@@ -24,7 +24,7 @@ pub fn runtime(
2424
scanner: *std.json.Scanner,
2525
ctx: *Ctx,
2626
) ![]const u8 {
27-
const method = std.meta.stringToEnum(RuntimeMethods, action) orelse
27+
const method = std.meta.stringToEnum(Methods, action) orelse
2828
return error.UnknownMethod;
2929
return switch (method) {
3030
.enable => enable(alloc, id, scanner, ctx),

src/cdp/target.zig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const result = cdp.result;
77
const getMsg = cdp.getMsg;
88
const stringify = cdp.stringify;
99

10-
const TargetMethods = enum {
10+
const Methods = enum {
1111
setDiscoverTargets,
1212
setAutoAttach,
1313
getTargetInfo,
@@ -23,12 +23,12 @@ pub fn target(
2323
scanner: *std.json.Scanner,
2424
ctx: *Ctx,
2525
) ![]const u8 {
26-
const method = std.meta.stringToEnum(TargetMethods, action) orelse
26+
const method = std.meta.stringToEnum(Methods, action) orelse
2727
return error.UnknownMethod;
2828
return switch (method) {
29-
.setDiscoverTargets => targetSetDiscoverTargets(alloc, id, scanner, ctx),
30-
.setAutoAttach => tagetSetAutoAttach(alloc, id, scanner, ctx),
31-
.getTargetInfo => tagetGetTargetInfo(alloc, id, scanner, ctx),
29+
.setDiscoverTargets => setDiscoverTargets(alloc, id, scanner, ctx),
30+
.setAutoAttach => setAutoAttach(alloc, id, scanner, ctx),
31+
.getTargetInfo => getTargetInfo(alloc, id, scanner, ctx),
3232
.getBrowserContexts => getBrowserContexts(alloc, id, scanner, ctx),
3333
.createBrowserContext => createBrowserContext(alloc, id, scanner, ctx),
3434
.createTarget => createTarget(alloc, id, scanner, ctx),
@@ -39,7 +39,7 @@ const PageTargetID = "CFCD6EC01573CF29BB638E9DC0F52DDC";
3939
const BrowserTargetID = "2d2bdef9-1c95-416f-8c0e-83f3ab73a30c";
4040
const BrowserContextID = "65618675CB7D3585A95049E9DFE95EA9";
4141

42-
fn targetSetDiscoverTargets(
42+
fn setDiscoverTargets(
4343
alloc: std.mem.Allocator,
4444
id: ?u16,
4545
scanner: *std.json.Scanner,
@@ -69,7 +69,7 @@ const TargetFilter = struct {
6969
exclude: ?bool = null,
7070
};
7171

72-
fn tagetSetAutoAttach(
72+
fn setAutoAttach(
7373
alloc: std.mem.Allocator,
7474
id: ?u16,
7575
scanner: *std.json.Scanner,
@@ -100,7 +100,7 @@ fn tagetSetAutoAttach(
100100
return result(alloc, id orelse msg.id.?, null, null, msg.sessionID);
101101
}
102102

103-
fn tagetGetTargetInfo(
103+
fn getTargetInfo(
104104
alloc: std.mem.Allocator,
105105
id: ?u16,
106106
scanner: *std.json.Scanner,

0 commit comments

Comments
 (0)