Commit 8af0a1987b
2020-11-18 12:58:27
1 parent
b498d26Changed files (2)
lib
std
special
src
lib/std/special/build_runner.zig
@@ -69,7 +69,7 @@ pub fn main() !void {
} else if (mem.startsWith(u8, arg, "-")) {
if (mem.eql(u8, arg, "--verbose")) {
builder.verbose = true;
- } else if (mem.eql(u8, arg, "--help")) {
+ } else if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
return usage(builder, false, stdout_stream);
} else if (mem.eql(u8, arg, "--prefix")) {
builder.install_prefix = nextArg(args, &arg_idx) orelse {
@@ -176,7 +176,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
try out_stream.writeAll(
\\
\\General Options:
- \\ --help Print this help and exit
+ \\ -h, --help Print this help and exit
\\ --verbose Print commands before executing them
\\ --prefix [path] Override default install prefix
\\ --search-prefix [path] Add a path to look for binaries, libraries, headers
src/main.zig
@@ -46,6 +46,7 @@ const usage =
\\ c++ Use Zig as a drop-in C++ compiler
\\ env Print lib path, std path, cache directory, and version
\\ fmt Reformat Zig source into canonical form
+ \\ help Print this help and exit
\\ init-exe Initialize a `zig build` application in the cwd
\\ init-lib Initialize a `zig build` library in the cwd
\\ libc Display native libc paths file or validate one
@@ -195,7 +196,7 @@ pub fn mainArgs(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
try @import("print_env.zig").cmdEnv(arena, cmd_args, io.getStdOut().outStream());
} else if (mem.eql(u8, cmd, "zen")) {
try io.getStdOut().writeAll(info_zen);
- } else if (mem.eql(u8, cmd, "help")) {
+ } else if (mem.eql(u8, cmd, "help") or mem.eql(u8, cmd, "-h") or mem.eql(u8, cmd, "--help")) {
try io.getStdOut().writeAll(usage);
} else {
std.log.info("{}", .{usage});