authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-17 16:47:36-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-17 16:53:45-07:00
logaf4727814b4b5a28551fe47c40e31f6fdc91ccbe
tree63b4d8ab47888e08e038e63eb607c0d9ddc6957f
parent2eee0582f8654cb2b344ed8e2c43dcda3424dbe5

cli: make -h, --help consistent in usage text and parsing

also trivial fixes in the general usage text

1 files changed, 10 insertions(+), 10 deletions(-)

src/main.zig+10-10
......@@ -41,11 +41,11 @@ const usage =
4141 \\ build Build project from build.zig
4242 \\ build-exe Create executable from source or object files
4343 \\ build-lib Create library from source or object files
44 \\ build-obj Create object from source or assembly
44 \\ build-obj Create object from source or object files
4545 \\ cc Use Zig as a drop-in C compiler
4646 \\ c++ Use Zig as a drop-in C++ compiler
47 \\ env Print lib path, std path, compiler id and version
48 \\ fmt Parse file and render in canonical zig format
47 \\ env Print lib path, std path, cache directory, and version
48 \\ fmt Reformat Zig source into canonical form
4949 \\ init-exe Initialize a `zig build` application in the cwd
5050 \\ init-lib Initialize a `zig build` library in the cwd
5151 \\ libc Display native libc paths file or validate one
......@@ -54,11 +54,11 @@ const usage =
5454 \\ targets List available compilation targets
5555 \\ test Create and run a test build
5656 \\ version Print version number and exit
57 \\ zen Print zen of zig and exit
57 \\ zen Print Zen of Zig and exit
5858 \\
5959 \\General Options:
6060 \\
61 \\ --help Print command-specific usage
61 \\ -h, --help Print command-specific usage
6262 \\
6363;
6464
......@@ -2017,7 +2017,7 @@ pub fn cmdLibC(gpa: *Allocator, args: []const []const u8) !void {
20172017 while (i < args.len) : (i += 1) {
20182018 const arg = args[i];
20192019 if (mem.startsWith(u8, arg, "-")) {
2020 if (mem.eql(u8, arg, "--help")) {
2020 if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
20212021 const stdout = io.getStdOut().writer();
20222022 try stdout.writeAll(usage_libc);
20232023 return cleanExit();
......@@ -2059,7 +2059,7 @@ pub const usage_init =
20592059 \\ directory.
20602060 \\
20612061 \\Options:
2062 \\ --help Print this help and exit
2062 \\ -h, --help Print this help and exit
20632063 \\
20642064 \\
20652065;
......@@ -2148,7 +2148,7 @@ pub const usage_build =
21482148 \\ Build a project from build.zig.
21492149 \\
21502150 \\Options:
2151 \\ --help Print this help and exit
2151 \\ -h, --help Print this help and exit
21522152 \\
21532153 \\
21542154;
......@@ -2400,7 +2400,7 @@ pub const usage_fmt =
24002400 \\ recursively.
24012401 \\
24022402 \\Options:
2403 \\ --help Print this help and exit
2403 \\ -h, --help Print this help and exit
24042404 \\ --color [auto|off|on] Enable or disable colored error messages
24052405 \\ --stdin Format code from stdin; output to stdout
24062406 \\ --check List non-conforming files and exit with an error
......@@ -2432,7 +2432,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void {
24322432 while (i < args.len) : (i += 1) {
24332433 const arg = args[i];
24342434 if (mem.startsWith(u8, arg, "-")) {
2435 if (mem.eql(u8, arg, "--help")) {
2435 if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
24362436 const stdout = io.getStdOut().outStream();
24372437 try stdout.writeAll(usage_fmt);
24382438 return cleanExit();