summaryrefslogtreecommitdiff
path: root/example/simple.zig
diff options
context:
space:
mode:
Diffstat (limited to 'example/simple.zig')
-rw-r--r--example/simple.zig11
1 files changed, 5 insertions, 6 deletions
diff --git a/example/simple.zig b/example/simple.zig
index 270e344..392dca3 100644
--- a/example/simple.zig
+++ b/example/simple.zig
@@ -1,5 +1,5 @@
1const std = @import("std");
2const clap = @import("clap"); 1const clap = @import("clap");
2const std = @import("std");
3 3
4const debug = std.debug; 4const debug = std.debug;
5 5
@@ -14,11 +14,10 @@ pub fn main() !void {
14 }; 14 };
15 15
16 // Initalize our diagnostics, which can be used for reporting useful errors. 16 // Initalize our diagnostics, which can be used for reporting useful errors.
17 // This is optional. You can also just pass `null` to `parser.next` if you 17 // This is optional. You can also pass `.{}` to `clap.parse` if you don't
18 // don't care about the extra information `Diagnostics` provides. 18 // care about the extra information `Diagnostics` provides.
19 var diag: clap.Diagnostic = undefined; 19 var diag = clap.Diagnostic{};
20 20 var args = clap.parse(clap.Help, &params, .{ .diagnostic = &diag }) catch |err| {
21 var args = clap.parse(clap.Help, &params, std.heap.page_allocator, &diag) catch |err| {
22 // Report useful error and exit 21 // Report useful error and exit
23 diag.report(std.io.getStdErr().outStream(), err) catch {}; 22 diag.report(std.io.getStdErr().outStream(), err) catch {};
24 return err; 23 return err;