From dfce396cf865e5cc05f46f3079e25c5acb98a4c3 Mon Sep 17 00:00:00 2001 From: g-w1 Date: Fri, 9 Oct 2020 16:34:39 -0400 Subject: [PATCH] friendly error message for zig run with no args --- src/main.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.zig b/src/main.zig index b43086cccd..a4c2f4f47b 100644 --- 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";