aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-11-17 16:47:36 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-11-17 16:53:45 -0700
commitaf4727814b4b5a28551fe47c40e31f6fdc91ccbe (patch)
tree63b4d8ab47888e08e038e63eb607c0d9ddc6957f /src/main.zig
parent2eee0582f8654cb2b344ed8e2c43dcda3424dbe5 (diff)
downloadzig-af4727814b4b5a28551fe47c40e31f6fdc91ccbe.tar.gz
zig-af4727814b4b5a28551fe47c40e31f6fdc91ccbe.zip
cli: make -h, --help consistent in usage text and parsing
also trivial fixes in the general usage text
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main.zig b/src/main.zig
index 33cceee3b9..a901e3bc0c 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -41,11 +41,11 @@ const usage =
\\ build Build project from build.zig
\\ build-exe Create executable from source or object files
\\ build-lib Create library from source or object files
- \\ build-obj Create object from source or assembly
+ \\ build-obj Create object from source or object files
\\ cc Use Zig as a drop-in C compiler
\\ c++ Use Zig as a drop-in C++ compiler
- \\ env Print lib path, std path, compiler id and version
- \\ fmt Parse file and render in canonical zig format
+ \\ env Print lib path, std path, cache directory, and version
+ \\ fmt Reformat Zig source into canonical form
\\ 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
@@ -54,11 +54,11 @@ const usage =
\\ targets List available compilation targets
\\ test Create and run a test build
\\ version Print version number and exit
- \\ zen Print zen of zig and exit
+ \\ zen Print Zen of Zig and exit
\\
\\General Options:
\\
- \\ --help Print command-specific usage
+ \\ -h, --help Print command-specific usage
\\
;
@@ -2017,7 +2017,7 @@ pub fn cmdLibC(gpa: *Allocator, args: []const []const u8) !void {
while (i < args.len) : (i += 1) {
const arg = args[i];
if (mem.startsWith(u8, arg, "-")) {
- if (mem.eql(u8, arg, "--help")) {
+ if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
const stdout = io.getStdOut().writer();
try stdout.writeAll(usage_libc);
return cleanExit();
@@ -2059,7 +2059,7 @@ pub const usage_init =
\\ directory.
\\
\\Options:
- \\ --help Print this help and exit
+ \\ -h, --help Print this help and exit
\\
\\
;
@@ -2148,7 +2148,7 @@ pub const usage_build =
\\ Build a project from build.zig.
\\
\\Options:
- \\ --help Print this help and exit
+ \\ -h, --help Print this help and exit
\\
\\
;
@@ -2400,7 +2400,7 @@ pub const usage_fmt =
\\ recursively.
\\
\\Options:
- \\ --help Print this help and exit
+ \\ -h, --help Print this help and exit
\\ --color [auto|off|on] Enable or disable colored error messages
\\ --stdin Format code from stdin; output to stdout
\\ --check List non-conforming files and exit with an error
@@ -2432,7 +2432,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void {
while (i < args.len) : (i += 1) {
const arg = args[i];
if (mem.startsWith(u8, arg, "-")) {
- if (mem.eql(u8, arg, "--help")) {
+ if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
const stdout = io.getStdOut().outStream();
try stdout.writeAll(usage_fmt);
return cleanExit();