diff options
| author | 2021-10-09 13:06:28 +0200 | |
|---|---|---|
| committer | 2021-10-09 13:06:28 +0200 | |
| commit | bf94b097c4134b9ceaf983984f71b688e36274a4 (patch) | |
| tree | 39e63af5cd21e59604913b00235ebd3acf473700 | |
| parent | Indent help text on every new line to allow for user-controlled wrapping (diff) | |
| download | zig-clap-bf94b097c4134b9ceaf983984f71b688e36274a4.tar.gz zig-clap-bf94b097c4134b9ceaf983984f71b688e36274a4.tar.xz zig-clap-bf94b097c4134b9ceaf983984f71b688e36274a4.zip | |
Fix uses of builtin
Diffstat (limited to '')
| -rw-r--r-- | README.md | 14 | ||||
| -rw-r--r-- | build.zig | 1 | ||||
| -rw-r--r-- | clap/args.zig | 2 |
3 files changed, 8 insertions, 9 deletions
| @@ -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 | } |
| @@ -1,7 +1,6 @@ | |||
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | const Builder = std.build.Builder; | 3 | const Builder = std.build.Builder; |
| 4 | const Mode = builtin.Mode; | ||
| 5 | 4 | ||
| 6 | pub fn build(b: *Builder) void { | 5 | pub 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 @@ | |||
| 1 | const builtin = @import("builtin"); | ||
| 1 | const std = @import("std"); | 2 | const std = @import("std"); |
| 2 | 3 | ||
| 3 | const builtin = std.builtin; | ||
| 4 | const debug = std.debug; | 4 | const debug = std.debug; |
| 5 | const heap = std.heap; | 5 | const heap = std.heap; |
| 6 | const mem = std.mem; | 6 | const mem = std.mem; |