diff options
| author | 2020-11-02 18:04:30 +0000 | |
|---|---|---|
| committer | 2020-11-02 19:05:41 +0100 | |
| commit | 42894f6c8b957541ac0b1830139312047cd8fdc6 (patch) | |
| tree | f5c6c839334b863f77e665879be0d467614543f2 /example/simple-error.zig | |
| parent | use null sentinel in OsIterator (#27) (diff) | |
| download | zig-clap-42894f6c8b957541ac0b1830139312047cd8fdc6.tar.gz zig-clap-42894f6c8b957541ac0b1830139312047cd8fdc6.tar.xz zig-clap-42894f6c8b957541ac0b1830139312047cd8fdc6.zip | |
Report error context in Diagnostic (#26)
Diffstat (limited to 'example/simple-error.zig')
| -rw-r--r-- | example/simple-error.zig | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/example/simple-error.zig b/example/simple-error.zig index 2c403fc..3c62f0e 100644 --- a/example/simple-error.zig +++ b/example/simple-error.zig | |||
| @@ -2,13 +2,11 @@ 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 | // First we specify what parameters our program can take. | ||
| 6 | // We can use `parseParam` to parse a string to a `Param(Help)` | ||
| 7 | const params = comptime [_]clap.Param(clap.Help){ | 5 | const params = comptime [_]clap.Param(clap.Help){ |
| 8 | clap.parseParam("-h, --help Display this help and exit.") catch unreachable, | 6 | clap.parseParam("-h, --help Display this help and exit.") catch unreachable, |
| 9 | }; | 7 | }; |
| 10 | 8 | ||
| 11 | var args = try clap.parse(clap.Help, ¶ms, std.heap.direct_allocator); | 9 | var args = try clap.parse(clap.Help, ¶ms, std.heap.direct_allocator, null); |
| 12 | defer args.deinit(); | 10 | defer args.deinit(); |
| 13 | 11 | ||
| 14 | _ = args.flag("--helps"); | 12 | _ = args.flag("--helps"); |