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:54:15-07:00
logeea4cd2924edcade85b77879384738d5593bbff5
treed63a96d94a4e633092993012bd89ab90466a3779
parent4d44a813dea076196d2de8d2a672924f82ff137f

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
......@@ -2020,7 +2020,7 @@ pub fn cmdLibC(gpa: *Allocator, args: []const []const u8) !void {
20202020 while (i < args.len) : (i += 1) {
20212021 const arg = args[i];
20222022 if (mem.startsWith(u8, arg, "-")) {
2023 if (mem.eql(u8, arg, "--help")) {
2023 if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
20242024 const stdout = io.getStdOut().writer();
20252025 try stdout.writeAll(usage_libc);
20262026 return cleanExit();
......@@ -2062,7 +2062,7 @@ pub const usage_init =
20622062 \\ directory.
20632063 \\
20642064 \\Options:
2065 \\ --help Print this help and exit
2065 \\ -h, --help Print this help and exit
20662066 \\
20672067 \\
20682068;
......@@ -2151,7 +2151,7 @@ pub const usage_build =
21512151 \\ Build a project from build.zig.
21522152 \\
21532153 \\Options:
2154 \\ --help Print this help and exit
2154 \\ -h, --help Print this help and exit
21552155 \\
21562156 \\
21572157;
......@@ -2403,7 +2403,7 @@ pub const usage_fmt =
24032403 \\ recursively.
24042404 \\
24052405 \\Options:
2406 \\ --help Print this help and exit
2406 \\ -h, --help Print this help and exit
24072407 \\ --color [auto|off|on] Enable or disable colored error messages
24082408 \\ --stdin Format code from stdin; output to stdout
24092409 \\ --check List non-conforming files and exit with an error
......@@ -2435,7 +2435,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void {
24352435 while (i < args.len) : (i += 1) {
24362436 const arg = args[i];
24372437 if (mem.startsWith(u8, arg, "-")) {
2438 if (mem.eql(u8, arg, "--help")) {
2438 if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
24392439 const stdout = io.getStdOut().outStream();
24402440 try stdout.writeAll(usage_fmt);
24412441 return cleanExit();