- Add new commands: annotate, narrative, requeue - Refactor WebSocket client into modular components (net/ws/) - Add rsync embedded binary support - Improve error handling and response packet processing - Update build.zig and completions
25 lines
538 B
Zig
25 lines
538 B
Zig
const std = @import("std");
|
|
|
|
pub fn jsonGetString(obj: std.json.ObjectMap, key: []const u8) ?[]const u8 {
|
|
const v_opt = obj.get(key);
|
|
if (v_opt == null) {
|
|
return null;
|
|
}
|
|
const v = v_opt.?;
|
|
if (v != .string) {
|
|
return null;
|
|
}
|
|
return v.string;
|
|
}
|
|
|
|
pub fn jsonGetInt(obj: std.json.ObjectMap, key: []const u8) ?i64 {
|
|
const v_opt = obj.get(key);
|
|
if (v_opt == null) {
|
|
return null;
|
|
}
|
|
const v = v_opt.?;
|
|
if (v != .integer) {
|
|
return null;
|
|
}
|
|
return v.integer;
|
|
}
|