diff options
| author | 2021-05-08 18:08:52 +0200 | |
|---|---|---|
| committer | 2021-05-08 18:08:52 +0200 | |
| commit | 4c14bfd5188bb61d7076bc33fccbcc6a5e9dac01 (patch) | |
| tree | 8f5267e4da9bbc14bd595697797457911d4b3081 /example/simple-error.zig | |
| parent | Refactor Diagnostic (and others) into a ParseOption struct (diff) | |
| download | zig-clap-4c14bfd5188bb61d7076bc33fccbcc6a5e9dac01.tar.gz zig-clap-4c14bfd5188bb61d7076bc33fccbcc6a5e9dac01.tar.xz zig-clap-4c14bfd5188bb61d7076bc33fccbcc6a5e9dac01.zip | |
Modernize codebase
* Better naming for variables
* Follow naming style of enums
* Use `writer()` instead of `outStream()`
* Change many initializers to be a one liner
* Don't explicitly initialize fields to their default value
Diffstat (limited to '')
| -rw-r--r-- | example/simple-error.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/example/simple-error.zig b/example/simple-error.zig index 3c62f0e..c04a9c6 100644 --- a/example/simple-error.zig +++ b/example/simple-error.zig | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | const std = @import("std"); | ||
| 2 | const clap = @import("clap"); | 1 | const clap = @import("clap"); |
| 2 | const std = @import("std"); | ||
| 3 | 3 | ||
| 4 | pub fn main() !void { | 4 | pub fn main() !void { |
| 5 | const params = comptime [_]clap.Param(clap.Help){ | 5 | const params = comptime [_]clap.Param(clap.Help){ |
| 6 | clap.parseParam("-h, --help Display this help and exit.") catch unreachable, | 6 | clap.parseParam("-h, --help Display this help and exit.") catch unreachable, |
| 7 | }; | 7 | }; |
| 8 | 8 | ||
| 9 | var args = try clap.parse(clap.Help, ¶ms, std.heap.direct_allocator, null); | 9 | var args = try clap.parse(clap.Help, ¶ms, .{}); |
| 10 | defer args.deinit(); | 10 | defer args.deinit(); |
| 11 | 11 | ||
| 12 | _ = args.flag("--helps"); | 12 | _ = args.flag("--helps"); |