From 9e6837a5fdb672dbf38b1315100a5dac7961b367 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Fri, 1 Dec 2023 20:21:03 +0100 Subject: main: get data and print it --- src/main.zig | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/main.zig b/src/main.zig index 7cf9729..ba479e9 100644 --- a/src/main.zig +++ b/src/main.zig @@ -9,31 +9,10 @@ pub fn main() !void{ const args = try std.process.argsAlloc(allocator); defer std.process.argsFree(allocator, args); - _ = try weatherFetcher.getData(allocator); + var daily = try weatherFetcher.getDailyData(allocator); + defer daily.deinit(); const stdout = std.io.getStdOut().writer(); try stdout.print("Weather app {s}\n", .{args}); + std.debug.print("{}\n", .{daily.data}); } - -//pub fn main() !void { -// // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`) -// std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); -// -// // stdout is for the actual output of your application, for example if you -// // are implementing gzip, then only the compressed bytes should be sent to -// // stdout, not any debugging messages. -// const stdout_file = std.io.getStdOut().writer(); -// var bw = std.io.bufferedWriter(stdout_file); -// const stdout = bw.writer(); -// -// try stdout.print("Run `zig build test` to run the tests.\n", .{}); -// -// try bw.flush(); // don't forget to flush! -//} -// -//test "simple test" { -// var list = std.ArrayList(i32).init(std.testing.allocator); -// defer list.deinit(); // try commenting this out and see if zig detects the memory leak! -// try list.append(42); -// try std.testing.expectEqual(@as(i32, 42), list.pop()); -//} -- cgit v1.2.3