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-ex.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-ex.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/example/simple-ex.zig b/example/simple-ex.zig index f504d63..f08751b 100644 --- a/example/simple-ex.zig +++ b/example/simple-ex.zig | |||
| @@ -2,6 +2,7 @@ const clap = @import("clap"); | |||
| 2 | const std = @import("std"); | 2 | const std = @import("std"); |
| 3 | 3 | ||
| 4 | const debug = std.debug; | 4 | const debug = std.debug; |
| 5 | const io = std.io; | ||
| 5 | 6 | ||
| 6 | pub fn main() !void { | 7 | pub fn main() !void { |
| 7 | const allocator = std.heap.page_allocator; | 8 | const allocator = std.heap.page_allocator; |
| @@ -29,7 +30,7 @@ pub fn main() !void { | |||
| 29 | .diagnostic = &diag, | 30 | .diagnostic = &diag, |
| 30 | }) catch |err| { | 31 | }) catch |err| { |
| 31 | // Report useful error and exit | 32 | // Report useful error and exit |
| 32 | diag.report(std.io.getStdErr().outStream(), err) catch {}; | 33 | diag.report(io.getStdErr().writer(), err) catch {}; |
| 33 | return err; | 34 | return err; |
| 34 | }; | 35 | }; |
| 35 | defer args.deinit(); | 36 | defer args.deinit(); |