Changes
2 changed files (+30/-0)
-
-
@@ -23,6 +23,7 @@const OutputFormat = enum { text, tsv, jsonl, }; const parser = .{
-
@@ -40,6 +41,7 @@ \\-f, --format <format> Output format.\\Available values are: \\* text ... Plain text format for human consumption. \\* tsv ... TSV (tab-separated values). \\* jsonl ... Newline delimited list of JSON documents. \\ );
-
@@ -107,6 +109,16 @@ server.value_ptr.unique_id,server.value_ptr.name, server.value_ptr.ip_addr, server.value_ptr.version, }) catch { // TODO: Create and return appropriate error code return ExitCode.not_ok; }; } }, .jsonl => { while (server_iter.next()) |server| { stdout.print("{}\n", .{ std.json.fmt(server.value_ptr, .{ .whitespace = .minified }), }) catch { // TODO: Create and return appropriate error code return ExitCode.not_ok;
-
-
-
@@ -28,6 +28,24 @@ ip_addr: std.net.Address,unique_id: []const u8, name: []const u8, version: []const u8, pub fn jsonStringify(self: *const Server, jws: anytype) !void { try jws.beginObject(); try jws.objectField("unique_id"); try jws.write(self.unique_id); try jws.objectField("name"); try jws.write(self.name); try jws.objectField("version"); try jws.write(self.version); try jws.objectField("address"); try jws.print("\"{}\"", .{self.ip_addr}); try jws.endObject(); } }; pub const ServerScanner = struct {
-