summaryrefslogtreecommitdiff
path: root/example/simple-ex.zig
diff options
context:
space:
mode:
authorGravatar Komari Spaghetti2021-05-08 18:08:52 +0200
committerGravatar Komari Spaghetti2021-05-08 18:08:52 +0200
commit4c14bfd5188bb61d7076bc33fccbcc6a5e9dac01 (patch)
tree8f5267e4da9bbc14bd595697797457911d4b3081 /example/simple-ex.zig
parentRefactor Diagnostic (and others) into a ParseOption struct (diff)
downloadzig-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 'example/simple-ex.zig')
-rw-r--r--example/simple-ex.zig3
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");
2const std = @import("std"); 2const std = @import("std");
3 3
4const debug = std.debug; 4const debug = std.debug;
5const io = std.io;
5 6
6pub fn main() !void { 7pub 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();