diff options
| author | 2021-05-08 18:08:52 +0200 | |
|---|---|---|
| committer | 2021-05-08 18:08:52 +0200 | |
| commit | 4c14bfd5188bb61d7076bc33fccbcc6a5e9dac01 (patch) | |
| tree | 8f5267e4da9bbc14bd595697797457911d4b3081 /example/help.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 'example/help.zig')
| -rw-r--r-- | example/help.zig | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/example/help.zig b/example/help.zig index 2775177..3cf9e42 100644 --- a/example/help.zig +++ b/example/help.zig | |||
| @@ -1,15 +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 stderr_file = std.io.getStdErr(); | ||
| 6 | var stderr_out_stream = stderr_file.outStream(); | ||
| 7 | |||
| 8 | // clap.help is a function that can print a simple help message, given a | 5 | // clap.help is a function that can print a simple help message, given a |
| 9 | // slice of Param(Help). There is also a helpEx, which can print a | 6 | // slice of Param(Help). There is also a helpEx, which can print a |
| 10 | // help message for any Param, but it is more verbose to call. | 7 | // help message for any Param, but it is more verbose to call. |
| 11 | try clap.help( | 8 | try clap.help( |
| 12 | stderr_out_stream, | 9 | std.io.getStdErr().writer(), |
| 13 | comptime &[_]clap.Param(clap.Help){ | 10 | comptime &[_]clap.Param(clap.Help){ |
| 14 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, | 11 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, |
| 15 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, | 12 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, |