aboutsummaryrefslogtreecommitdiff
path: root/lib/std/special
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-10-13 20:06:03 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2020-10-13 20:06:03 +0200
commitf01c3150c19fa3d6c605cc1940f70cce303c5997 (patch)
tree6681df7149b1e9ff8c6fc64d41365ab0cf0c8f12 /lib/std/special
parentea45ee54843b10a433bb223caa9706d8253e3222 (diff)
downloadzig-f01c3150c19fa3d6c605cc1940f70cce303c5997.tar.gz
zig-f01c3150c19fa3d6c605cc1940f70cce303c5997.zip
std/build: support --color
Diffstat (limited to 'lib/std/special')
-rw-r--r--lib/std/special/build_runner.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
index 43d6b96536..f861d3159b 100644
--- a/lib/std/special/build_runner.zig
+++ b/lib/std/special/build_runner.zig
@@ -82,6 +82,15 @@ pub fn main() !void {
return usageAndErr(builder, false, stderr_stream);
};
builder.addSearchPrefix(search_prefix);
+ } else if (mem.eql(u8, arg, "--color")) {
+ const next_arg = nextArg(args, &arg_idx) orelse {
+ warn("expected [auto|on|off] after --color", .{});
+ return usageAndErr(builder, false, stderr_stream);
+ };
+ builder.color = std.meta.stringToEnum(@TypeOf(builder.color), next_arg) orelse {
+ warn("expected [auto|on|off] after --color, found '{}'", .{next_arg});
+ return usageAndErr(builder, false, stderr_stream);
+ };
} else if (mem.eql(u8, arg, "--override-lib-dir")) {
builder.override_lib_dir = nextArg(args, &arg_idx) orelse {
warn("Expected argument after --override-lib-dir\n\n", .{});
@@ -171,6 +180,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
\\ --verbose Print commands before executing them
\\ --prefix [path] Override default install prefix
\\ --search-prefix [path] Add a path to look for binaries, libraries, headers
+ \\ --color [auto|off|on] Enable or disable colored error messages
\\
\\Project-Specific Options:
\\