commit dfce396cf865e5cc05f46f3079e25c5acb98a4c3 (tree)
parent e892ee17e680d12292b971b553b36067ed3bbd74
Author: g-w1 <jacoblevgw@gmail.com>
Date: Fri, 9 Oct 2020 16:34:39 -0400
friendly error message for zig run with no args
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/main.zig b/src/main.zig
@@ -1269,6 +1269,10 @@ fn buildOutputType(
fatal("one zig source file is required to run `zig test`", .{});
}
+ if (link_objects.items.len == 0 and root_src_file == null and c_source_files.items.len == 0 and arg_mode == .run) {
+ fatal("one source file is required to run `zig run`", .{});
+ }
+
const root_name = if (provided_name) |n| n else blk: {
if (arg_mode == .zig_test) {
break :blk "test";