diff options
| author | 2021-07-17 10:43:05 +0000 | |
|---|---|---|
| committer | 2021-07-17 10:43:05 +0000 | |
| commit | 9bff7f332b86a18ff2f34e5c59ebdad5336e9850 (patch) | |
| tree | c52a4f776554ae4378f57a35d8b6b264a89cb739 /example | |
| parent | Forward diagnostics down to StreamingClap (diff) | |
| download | zig-clap-9bff7f332b86a18ff2f34e5c59ebdad5336e9850.tar.gz zig-clap-9bff7f332b86a18ff2f34e5c59ebdad5336e9850.tar.xz zig-clap-9bff7f332b86a18ff2f34e5c59ebdad5336e9850.zip | |
Use debug.print instead of deprecated debug.warn in examples
fixes comment on #11
Diffstat (limited to 'example')
| -rw-r--r-- | example/simple-ex.zig | 8 | ||||
| -rw-r--r-- | example/simple.zig | 8 | ||||
| -rw-r--r-- | example/streaming-clap.zig | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/example/simple-ex.zig b/example/simple-ex.zig index 838b9c2..5653fd1 100644 --- a/example/simple-ex.zig +++ b/example/simple-ex.zig | |||
| @@ -36,11 +36,11 @@ pub fn main() !void { | |||
| 36 | defer args.deinit(); | 36 | defer args.deinit(); |
| 37 | 37 | ||
| 38 | if (args.flag("--help")) | 38 | if (args.flag("--help")) |
| 39 | debug.warn("--help\n", .{}); | 39 | debug.print("--help\n", .{}); |
| 40 | if (args.option("--number")) |n| | 40 | if (args.option("--number")) |n| |
| 41 | debug.warn("--number = {s}\n", .{n}); | 41 | debug.print("--number = {s}\n", .{n}); |
| 42 | for (args.options("--string")) |s| | 42 | for (args.options("--string")) |s| |
| 43 | debug.warn("--string = {s}\n", .{s}); | 43 | debug.print("--string = {s}\n", .{s}); |
| 44 | for (args.positionals()) |pos| | 44 | for (args.positionals()) |pos| |
| 45 | debug.warn("{s}\n", .{pos}); | 45 | debug.print("{s}\n", .{pos}); |
| 46 | } | 46 | } |
diff --git a/example/simple.zig b/example/simple.zig index 78a963c..ff6d301 100644 --- a/example/simple.zig +++ b/example/simple.zig | |||
| @@ -26,11 +26,11 @@ pub fn main() !void { | |||
| 26 | defer args.deinit(); | 26 | defer args.deinit(); |
| 27 | 27 | ||
| 28 | if (args.flag("--help")) | 28 | if (args.flag("--help")) |
| 29 | debug.warn("--help\n", .{}); | 29 | debug.print("--help\n", .{}); |
| 30 | if (args.option("--number")) |n| | 30 | if (args.option("--number")) |n| |
| 31 | debug.warn("--number = {s}\n", .{n}); | 31 | debug.print("--number = {s}\n", .{n}); |
| 32 | for (args.options("--string")) |s| | 32 | for (args.options("--string")) |s| |
| 33 | debug.warn("--string = {s}\n", .{s}); | 33 | debug.print("--string = {s}\n", .{s}); |
| 34 | for (args.positionals()) |pos| | 34 | for (args.positionals()) |pos| |
| 35 | debug.warn("{s}\n", .{pos}); | 35 | debug.print("{s}\n", .{pos}); |
| 36 | } | 36 | } |
diff --git a/example/streaming-clap.zig b/example/streaming-clap.zig index 5f7f219..9ed38dd 100644 --- a/example/streaming-clap.zig +++ b/example/streaming-clap.zig | |||
| @@ -44,13 +44,13 @@ pub fn main() !void { | |||
| 44 | }) |arg| { | 44 | }) |arg| { |
| 45 | // arg.param will point to the parameter which matched the argument. | 45 | // arg.param will point to the parameter which matched the argument. |
| 46 | switch (arg.param.id) { | 46 | switch (arg.param.id) { |
| 47 | 'h' => debug.warn("Help!\n", .{}), | 47 | 'h' => debug.print("Help!\n", .{}), |
| 48 | 'n' => debug.warn("--number = {s}\n", .{arg.value.?}), | 48 | 'n' => debug.print("--number = {s}\n", .{arg.value.?}), |
| 49 | 49 | ||
| 50 | // arg.value == null, if arg.param.takes_value == .none. | 50 | // arg.value == null, if arg.param.takes_value == .none. |
| 51 | // Otherwise, arg.value is the value passed with the argument, such as "-a=10" | 51 | // Otherwise, arg.value is the value passed with the argument, such as "-a=10" |
| 52 | // or "-a 10". | 52 | // or "-a 10". |
| 53 | 'f' => debug.warn("{s}\n", .{arg.value.?}), | 53 | 'f' => debug.print("{s}\n", .{arg.value.?}), |
| 54 | else => unreachable, | 54 | else => unreachable, |
| 55 | } | 55 | } |
| 56 | } | 56 | } |