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, 10 insertions, 1 deletions
diff --git a/example/simple.zig b/example/simple.zig
index adea9f9..f7b5953 100644
--- a/example/simple.zig
+++ b/example/simple.zig
@@ -15,7 +15,16 @@ pub fn main() !void {
15 }, 15 },
16 }; 16 };
17 17
18 var args = try clap.parse(clap.Help, &params, std.heap.page_allocator); 18 // Initalize our diagnostics, which can be used for reporting useful errors.
19 // This is optional. You can also just pass `null` to `parser.next` if you
20 // don't care about the extra information `Diagnostics` provides.
21 var diag: clap.Diagnostic = undefined;
22
23 var args = clap.parse(clap.Help, &params, std.heap.page_allocator, &diag) catch |err| {
24 // Report useful error and exit
25 diag.report(std.io.getStdErr().outStream(), err) catch {};
26 return err;
27 };
19 defer args.deinit(); 28 defer args.deinit();
20 29
21 if (args.flag("--help")) 30 if (args.flag("--help"))