return status code
This commit is contained in:
parent
e192a3f9c5
commit
da13b41cc3
1 changed files with 6 additions and 7 deletions
13
src/main.zig
13
src/main.zig
|
@ -46,7 +46,7 @@ const ThreadContext = struct {
|
||||||
allocator: Allocator,
|
allocator: Allocator,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !u8 {
|
||||||
var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
|
var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
|
||||||
|
|
||||||
const gpa, const is_debug = gpa: {
|
const gpa, const is_debug = gpa: {
|
||||||
|
@ -65,14 +65,15 @@ pub fn main() !void {
|
||||||
defer std.process.argsFree(allocator, args);
|
defer std.process.argsFree(allocator, args);
|
||||||
|
|
||||||
if (args.len < 2) {
|
if (args.len < 2) {
|
||||||
print("Usage: {s} <config-file>\n", .{args[0]});
|
const stdout = std.io.getStdOut().writer();
|
||||||
return;
|
try stdout.print("Usage: {s} <config-file> [atom-feed-file]\n", .{args[0]});
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const config_path = args[1];
|
const config_path = args[1];
|
||||||
var app_config = config.loadConfig(allocator, config_path) catch |err| {
|
var app_config = config.loadConfig(allocator, config_path) catch |err| {
|
||||||
print("Error loading config: {}\n", .{err});
|
print("Error loading config: {}\n", .{err});
|
||||||
return;
|
return 1;
|
||||||
};
|
};
|
||||||
defer app_config.deinit();
|
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("Total releases in feed: {}\n", .{all_releases.items.len});
|
||||||
std.debug.print("Updated feed written to: {s}\n", .{output_file});
|
std.debug.print("Updated feed written to: {s}\n", .{output_file});
|
||||||
|
|
||||||
print("Atom feed generated: releases.xml\n", .{});
|
return 0;
|
||||||
print("Found {} new releases\n", .{new_releases.items.len});
|
|
||||||
print("Total releases in feed: {}\n", .{all_releases.items.len});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test "main functionality" {
|
test "main functionality" {
|
||||||
|
|
Loading…
Add table
Reference in a new issue