summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Komari Spaghetti2021-10-09 13:06:28 +0200
committerGravatar Komari Spaghetti2021-10-09 13:06:28 +0200
commitbf94b097c4134b9ceaf983984f71b688e36274a4 (patch)
tree39e63af5cd21e59604913b00235ebd3acf473700
parentIndent help text on every new line to allow for user-controlled wrapping (diff)
downloadzig-clap-bf94b097c4134b9ceaf983984f71b688e36274a4.tar.gz
zig-clap-bf94b097c4134b9ceaf983984f71b688e36274a4.tar.xz
zig-clap-bf94b097c4134b9ceaf983984f71b688e36274a4.zip
Fix uses of builtin
Diffstat (limited to '')
-rw-r--r--README.md14
-rw-r--r--build.zig1
-rw-r--r--clap/args.zig2
3 files changed, 8 insertions, 9 deletions
diff --git a/README.md b/README.md
index 646c052..197eb4c 100644
--- a/README.md
+++ b/README.md
@@ -53,13 +53,13 @@ pub fn main() !void {
53 defer args.deinit(); 53 defer args.deinit();
54 54
55 if (args.flag("--help")) 55 if (args.flag("--help"))
56 debug.warn("--help\n", .{}); 56 debug.print("--help\n", .{});
57 if (args.option("--number")) |n| 57 if (args.option("--number")) |n|
58 debug.warn("--number = {s}\n", .{n}); 58 debug.print("--number = {s}\n", .{n});
59 for (args.options("--string")) |s| 59 for (args.options("--string")) |s|
60 debug.warn("--string = {s}\n", .{s}); 60 debug.print("--string = {s}\n", .{s});
61 for (args.positionals()) |pos| 61 for (args.positionals()) |pos|
62 debug.warn("{s}\n", .{pos}); 62 debug.print("{s}\n", .{pos});
63} 63}
64 64
65``` 65```
@@ -153,13 +153,13 @@ pub fn main() !void {
153 }) |arg| { 153 }) |arg| {
154 // arg.param will point to the parameter which matched the argument. 154 // arg.param will point to the parameter which matched the argument.
155 switch (arg.param.id) { 155 switch (arg.param.id) {
156 'h' => debug.warn("Help!\n", .{}), 156 'h' => debug.print("Help!\n", .{}),
157 'n' => debug.warn("--number = {s}\n", .{arg.value.?}), 157 'n' => debug.print("--number = {s}\n", .{arg.value.?}),
158 158
159 // arg.value == null, if arg.param.takes_value == .none. 159 // arg.value == null, if arg.param.takes_value == .none.
160 // Otherwise, arg.value is the value passed with the argument, such as "-a=10" 160 // Otherwise, arg.value is the value passed with the argument, such as "-a=10"
161 // or "-a 10". 161 // or "-a 10".
162 'f' => debug.warn("{s}\n", .{arg.value.?}), 162 'f' => debug.print("{s}\n", .{arg.value.?}),
163 else => unreachable, 163 else => unreachable,
164 } 164 }
165 } 165 }
diff --git a/build.zig b/build.zig
index fcb72b5..d2e264a 100644
--- a/build.zig
+++ b/build.zig
@@ -1,7 +1,6 @@
1const std = @import("std"); 1const std = @import("std");
2 2
3const Builder = std.build.Builder; 3const Builder = std.build.Builder;
4const Mode = builtin.Mode;
5 4
6pub fn build(b: *Builder) void { 5pub fn build(b: *Builder) void {
7 const mode = b.standardReleaseOptions(); 6 const mode = b.standardReleaseOptions();
diff --git a/clap/args.zig b/clap/args.zig
index 1d93189..a6be833 100644
--- a/clap/args.zig
+++ b/clap/args.zig
@@ -1,6 +1,6 @@
1const builtin = @import("builtin");
1const std = @import("std"); 2const std = @import("std");
2 3
3const builtin = std.builtin;
4const debug = std.debug; 4const debug = std.debug;
5const heap = std.heap; 5const heap = std.heap;
6const mem = std.mem; 6const mem = std.mem;