Skip to content

Commit 0594b39

Browse files
committed
add check for wrong number of arguments
1 parent 94f3711 commit 0594b39

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

build/ClarParser.zig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ pub fn main(init: std.process.Init) !void {
77
const arena = init.arena.allocator();
88
const cwd = std.Io.Dir.cwd();
99
const args = try init.minimal.args.toSlice(arena);
10+
if (args.len != 2) {
11+
std.log.err("expected exactly one argument, but received: {d}", .{args.len});
12+
return error.InvalidArgs;
13+
}
1014
const input = try cwd.openFile(io, args[1], .{});
1115
defer input.close(io);
1216

0 commit comments

Comments
 (0)