authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-11-18 13:58:27+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-18 17:37:14-07:00
log8af0a1987b940732b13b6d4c4e33c00637f69dd5
treef03822d6bb094cbf7d85ba28a1d192e39a25aa4c
parentb498d26376cc46481f06f09f5f8eaf32ce81801f

make help in commands more consistent

Closes #7101 Co-authored-by: pfg <pfg@pfg.pw>

2 files changed, 4 insertions(+), 3 deletions(-)

lib/std/special/build_runner.zig+2-2
......@@ -69,7 +69,7 @@ pub fn main() !void {
6969 } else if (mem.startsWith(u8, arg, "-")) {
7070 if (mem.eql(u8, arg, "--verbose")) {
7171 builder.verbose = true;
72 } else if (mem.eql(u8, arg, "--help")) {
72 } else if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
7373 return usage(builder, false, stdout_stream);
7474 } else if (mem.eql(u8, arg, "--prefix")) {
7575 builder.install_prefix = nextArg(args, &arg_idx) orelse {
......@@ -176,7 +176,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
176176 try out_stream.writeAll(
177177 \\
178178 \\General Options:
179 \\ --help Print this help and exit
179 \\ -h, --help Print this help and exit
180180 \\ --verbose Print commands before executing them
181181 \\ --prefix [path] Override default install prefix
182182 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
src/main.zig+2-1
......@@ -46,6 +46,7 @@ const usage =
4646 \\ c++ Use Zig as a drop-in C++ compiler
4747 \\ env Print lib path, std path, cache directory, and version
4848 \\ fmt Reformat Zig source into canonical form
49 \\ help Print this help and exit
4950 \\ init-exe Initialize a `zig build` application in the cwd
5051 \\ init-lib Initialize a `zig build` library in the cwd
5152 \\ 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
195196 try @import("print_env.zig").cmdEnv(arena, cmd_args, io.getStdOut().outStream());
196197 } else if (mem.eql(u8, cmd, "zen")) {
197198 try io.getStdOut().writeAll(info_zen);
198 } else if (mem.eql(u8, cmd, "help")) {
199 } else if (mem.eql(u8, cmd, "help") or mem.eql(u8, cmd, "-h") or mem.eql(u8, cmd, "--help")) {
199200 try io.getStdOut().writeAll(usage);
200201 } else {
201202 std.log.info("{}", .{usage});