Changes
6 changed files (+30/-19)
-
-
@@ -43,7 +43,9 @@ };defer res.deinit(); if (res.args.help > 0) { clap.help(std.io.getStdOut().writer(), clap.Help, ¶ms, .{}) catch {}; clap.help(std.io.getStdOut().writer(), clap.Help, ¶ms, .{}) catch { return ExitCode.stdout_write_failed; }; return ExitCode.ok; }
-
@@ -65,7 +67,12 @@ };for (zones.value.zones) |zone| { if (std.mem.eql(u8, name, zone.display_name)) { std.fmt.format(std.io.getStdOut().writer(), "{s}\n", .{@tagName(zone.state)}) catch {}; std.fmt.format( std.io.getStdOut().writer(), "{s}\n", .{@tagName(zone.state)}, ) catch return ExitCode.stdout_write_failed; return ExitCode.ok; } }
-
-
-
@@ -38,7 +38,9 @@ };defer res.deinit(); if (res.args.help > 0) { clap.help(std.io.getStdOut().writer(), clap.Help, ¶ms, .{}) catch {}; clap.help(std.io.getStdOut().writer(), clap.Help, ¶ms, .{}) catch { return ExitCode.stdout_write_failed; }; return ExitCode.ok; }
-
-
-
@@ -53,7 +53,9 @@ };defer res.deinit(); if (res.args.help > 0) { clap.help(std.io.getStdOut().writer(), clap.Help, ¶ms, .{}) catch {}; clap.help(std.io.getStdOut().writer(), clap.Help, ¶ms, .{}) catch { return ExitCode.stdout_write_failed; }; return ExitCode.ok; }
-
-
-
@@ -98,7 +98,7 @@switch (res.args.format orelse .address) { .address => { stdout.print("{}\n", .{found.getAddr()}) catch { return ExitCode.not_ok; return ExitCode.stdout_write_failed; }; }, .text => {
-
@@ -107,16 +107,14 @@ found.getId(),found.getAddr(), found.getVersion(), }) catch { // TODO: Create and return appropriate error code return ExitCode.not_ok; return ExitCode.stdout_write_failed; }; }, .json => { stdout.print("{}\n", .{ std.json.fmt(found, .{ .whitespace = .minified }), }) catch { // TODO: Create and return appropriate error code return ExitCode.not_ok; return ExitCode.stdout_write_failed; }; }, }
-
-
-
@@ -57,14 +57,14 @@ };defer res.deinit(); if (res.args.help > 0) { clap.help(std.io.getStdOut().writer(), clap.Help, ¶ms, .{}) catch {}; clap.help(std.io.getStdOut().writer(), clap.Help, ¶ms, .{}) catch { return ExitCode.stdout_write_failed; }; return ExitCode.ok; } const count = res.args.count orelse 3; const wait = res.args.wait orelse 2; const stdout = std.io.getStdOut().writer(); var opts: core.server.ScanOptions = undefined; opts.init();
-
@@ -89,6 +89,8 @@ std.log.err("Failed to scan: {s}", .{@tagName(result.code)});return ExitCode.not_ok; } const stdout = std.io.getStdOut().writer(); switch (res.args.format orelse .text) { .text => { while (result.next()) |server| {
-
@@ -97,8 +99,7 @@ server.getId(),server.getAddr(), server.getVersion(), }) catch { // TODO: Create and return appropriate error code return ExitCode.not_ok; return ExitCode.stdout_write_failed; }; server.free(); }
-
@@ -106,7 +107,7 @@ },.tsv => { if (res.args.header > 0) { stdout.writeAll("ID\tName\tIP address\tVersion\n") catch { return ExitCode.not_ok; return ExitCode.stdout_write_failed; }; } while (result.next()) |server| {
-
@@ -117,8 +118,7 @@ server.getName(),server.getAddr(), server.getVersion(), }) catch { // TODO: Create and return appropriate error code return ExitCode.not_ok; return ExitCode.stdout_write_failed; }; server.free(); }
-
@@ -128,8 +128,7 @@ while (result.next()) |server| {stdout.print("{}\n", .{ std.json.fmt(server, .{ .whitespace = .minified }), }) catch { // TODO: Create and return appropriate error code return ExitCode.not_ok; return ExitCode.stdout_write_failed; }; server.free(); }
-
-
-
@@ -27,4 +27,7 @@ incorrect_usage = 2,/// Out of memory, or a NULL pointer passed to a function due to bug. out_of_memory = 3, /// Unable to write command output to stdout. stdout_write_failed = 4, };
-