AOC2024/src/lib/args.zig
jmug 00803fd554 Add helpers for parsing.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
2024-12-02 22:32:12 +00:00

16 lines
389 B
Zig

const std = @import("std");
const process = std.process;
const print = std.debug.print;
pub fn getFirstArg() [:0]const u8 {
var args = process.args();
defer args.deinit();
// Skip the first argument since it's the name of the program.
_ = args.skip();
return args.next() orelse {
print("Provide at least one input\n", .{});
process.exit(1);
};
}