diff options
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig index 6bb9777..77baae8 100644 --- a/src/main.zig +++ b/src/main.zig @@ -79,6 +79,13 @@ pub fn main(init: std.process.Init) !u8 { if (ceps.items.len == 1) { var address = client.lookup(ceps.items[0], .{ .diagnostics = &diag }) catch |err| { try out.print("{s}: {t}: {s}\n", .{ ceps.items[0], err, diag.message() }); + // Not an address — the lookup failed. Only where the number would + // have landed, which is usually the useful thing to say back. + if (diag.faixa()) |faixa| { + try out.print(" would be in {s}/{s}, which has {d} CEPs between {s} and {s}\n", .{ + faixa.localidade, faixa.uf, faixa.ceps, faixa.cep_ini, faixa.cep_fim, + }); + } return 1; }; defer address.deinit(gpa); |