diff options
| author | 2021-01-10 12:34:39 +1100 | |
|---|---|---|
| committer | 2021-01-10 03:15:40 +0100 | |
| commit | fb1eb05c2114123fff3981923bacfb74ac6b03ae (patch) | |
| tree | 2f20569e10692513e5e2e4a317b938acbfdc8170 /example | |
| parent | Support all arguments after -- being positionals (diff) | |
| download | zig-clap-fb1eb05c2114123fff3981923bacfb74ac6b03ae.tar.gz zig-clap-fb1eb05c2114123fff3981923bacfb74ac6b03ae.tar.xz zig-clap-fb1eb05c2114123fff3981923bacfb74ac6b03ae.zip | |
zig master updates
Diffstat (limited to 'example')
| -rw-r--r-- | example/help.zig | 2 | ||||
| -rw-r--r-- | example/simple-ex.zig | 2 | ||||
| -rw-r--r-- | example/simple.zig | 2 | ||||
| -rw-r--r-- | example/streaming-clap.zig | 2 | ||||
| -rw-r--r-- | example/usage.zig | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/example/help.zig b/example/help.zig index 2775177..c210ff9 100644 --- a/example/help.zig +++ b/example/help.zig | |||
| @@ -3,7 +3,7 @@ const clap = @import("clap"); | |||
| 3 | 3 | ||
| 4 | pub fn main() !void { | 4 | pub fn main() !void { |
| 5 | const stderr_file = std.io.getStdErr(); | 5 | const stderr_file = std.io.getStdErr(); |
| 6 | var stderr_out_stream = stderr_file.outStream(); | 6 | var stderr_out_stream = stderr_file.writer(); |
| 7 | 7 | ||
| 8 | // clap.help is a function that can print a simple help message, given a | 8 | // clap.help is a function that can print a simple help message, given a |
| 9 | // slice of Param(Help). There is also a helpEx, which can print a | 9 | // slice of Param(Help). There is also a helpEx, which can print a |
diff --git a/example/simple-ex.zig b/example/simple-ex.zig index d6ecc44..b890860 100644 --- a/example/simple-ex.zig +++ b/example/simple-ex.zig | |||
| @@ -27,7 +27,7 @@ pub fn main() !void { | |||
| 27 | 27 | ||
| 28 | var args = clap.parseEx(clap.Help, ¶ms, allocator, &iter, &diag) catch |err| { | 28 | var args = clap.parseEx(clap.Help, ¶ms, allocator, &iter, &diag) catch |err| { |
| 29 | // Report useful error and exit | 29 | // Report useful error and exit |
| 30 | diag.report(std.io.getStdErr().outStream(), err) catch {}; | 30 | diag.report(std.io.getStdErr().writer(), err) catch {}; |
| 31 | return err; | 31 | return err; |
| 32 | }; | 32 | }; |
| 33 | defer args.deinit(); | 33 | defer args.deinit(); |
diff --git a/example/simple.zig b/example/simple.zig index 270e344..559bba6 100644 --- a/example/simple.zig +++ b/example/simple.zig | |||
| @@ -20,7 +20,7 @@ pub fn main() !void { | |||
| 20 | 20 | ||
| 21 | var args = clap.parse(clap.Help, ¶ms, std.heap.page_allocator, &diag) catch |err| { | 21 | var args = clap.parse(clap.Help, ¶ms, std.heap.page_allocator, &diag) catch |err| { |
| 22 | // Report useful error and exit | 22 | // Report useful error and exit |
| 23 | diag.report(std.io.getStdErr().outStream(), err) catch {}; | 23 | diag.report(std.io.getStdErr().writer(), err) catch {}; |
| 24 | return err; | 24 | return err; |
| 25 | }; | 25 | }; |
| 26 | defer args.deinit(); | 26 | defer args.deinit(); |
diff --git a/example/streaming-clap.zig b/example/streaming-clap.zig index 941070f..5468fd5 100644 --- a/example/streaming-clap.zig +++ b/example/streaming-clap.zig | |||
| @@ -42,7 +42,7 @@ pub fn main() !void { | |||
| 42 | // Because we use a streaming parser, we have to consume each argument parsed individually. | 42 | // Because we use a streaming parser, we have to consume each argument parsed individually. |
| 43 | while (parser.next(&diag) catch |err| { | 43 | while (parser.next(&diag) catch |err| { |
| 44 | // Report useful error and exit | 44 | // Report useful error and exit |
| 45 | diag.report(std.io.getStdErr().outStream(), err) catch {}; | 45 | diag.report(std.io.getStdErr().writer(), err) catch {}; |
| 46 | return err; | 46 | return err; |
| 47 | }) |arg| { | 47 | }) |arg| { |
| 48 | // arg.param will point to the parameter which matched the argument. | 48 | // arg.param will point to the parameter which matched the argument. |
diff --git a/example/usage.zig b/example/usage.zig index 25e1a34..dc88c48 100644 --- a/example/usage.zig +++ b/example/usage.zig | |||
| @@ -2,7 +2,7 @@ const std = @import("std"); | |||
| 2 | const clap = @import("clap"); | 2 | const clap = @import("clap"); |
| 3 | 3 | ||
| 4 | pub fn main() !void { | 4 | pub fn main() !void { |
| 5 | const stderr = std.io.getStdErr().outStream(); | 5 | const stderr = std.io.getStdErr().writer(); |
| 6 | 6 | ||
| 7 | // clap.usage is a function that can print a simple usage message, given a | 7 | // clap.usage is a function that can print a simple usage message, given a |
| 8 | // slice of Param(Help). There is also a usageEx, which can print a | 8 | // slice of Param(Help). There is also a usageEx, which can print a |