From da13b41cc35a5298e46040cf15ddcd131b7fdf49 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Sat, 12 Jul 2025 18:06:06 -0700 Subject: [PATCH] return status code --- src/main.zig | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main.zig b/src/main.zig index 9977783..913854b 100644 --- a/src/main.zig +++ b/src/main.zig @@ -46,7 +46,7 @@ const ThreadContext = struct { allocator: Allocator, }; -pub fn main() !void { +pub fn main() !u8 { var debug_allocator: std.heap.DebugAllocator(.{}) = .init; const gpa, const is_debug = gpa: { @@ -65,14 +65,15 @@ pub fn main() !void { defer std.process.argsFree(allocator, args); if (args.len < 2) { - print("Usage: {s} \n", .{args[0]}); - return; + const stdout = std.io.getStdOut().writer(); + try stdout.print("Usage: {s} [atom-feed-file]\n", .{args[0]}); + return 0; } const config_path = args[1]; var app_config = config.loadConfig(allocator, config_path) catch |err| { print("Error loading config: {}\n", .{err}); - return; + return 1; }; defer app_config.deinit(); @@ -184,9 +185,7 @@ pub fn main() !void { std.debug.print("Total releases in feed: {}\n", .{all_releases.items.len}); std.debug.print("Updated feed written to: {s}\n", .{output_file}); - print("Atom feed generated: releases.xml\n", .{}); - print("Found {} new releases\n", .{new_releases.items.len}); - print("Total releases in feed: {}\n", .{all_releases.items.len}); + return 0; } test "main functionality" {