diff options
| author | 2019-12-03 05:43:43 +0100 | |
|---|---|---|
| committer | 2019-12-03 05:43:43 +0100 | |
| commit | ac461f50df2861eb9b6834ba770c3c149c72eb9c (patch) | |
| tree | 7d76dca13427d585cff36c38230d368e51fb3c20 /README.md | |
| parent | Add clap.parse as the simplest way of using the lib (diff) | |
| parent | update for latest zig (diff) | |
| download | zig-clap-ac461f50df2861eb9b6834ba770c3c149c72eb9c.tar.gz zig-clap-ac461f50df2861eb9b6834ba770c3c149c72eb9c.tar.xz zig-clap-ac461f50df2861eb9b6834ba770c3c149c72eb9c.zip | |
Merge pull request #12 from dbandstra/update-for-latest-zig
update for latest zig
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -36,7 +36,7 @@ pub fn main() !void { | |||
| 36 | }, | 36 | }, |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | var args = try clap.parse(clap.Help, params, std.heap.direct_allocator); | 39 | var args = try clap.parse(clap.Help, ¶ms, std.heap.direct_allocator); |
| 40 | defer args.deinit(); | 40 | defer args.deinit(); |
| 41 | 41 | ||
| 42 | if (args.flag("--help")) | 42 | if (args.flag("--help")) |
| @@ -63,7 +63,7 @@ pub fn main() !void { | |||
| 63 | clap.parseParam("-h, --help Display this help and exit.") catch unreachable, | 63 | clap.parseParam("-h, --help Display this help and exit.") catch unreachable, |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | var args = try clap.parse(clap.Help, params, std.heap.direct_allocator); | 66 | var args = try clap.parse(clap.Help, ¶ms, std.heap.direct_allocator); |
| 67 | defer args.deinit(); | 67 | defer args.deinit(); |
| 68 | 68 | ||
| 69 | _ = args.flag("--helps"); | 69 | _ = args.flag("--helps"); |
| @@ -115,7 +115,7 @@ pub fn main() !void { | |||
| 115 | defer iter.deinit(); | 115 | defer iter.deinit(); |
| 116 | 116 | ||
| 117 | // Parse the arguments | 117 | // Parse the arguments |
| 118 | var args = try clap.ComptimeClap(clap.Help, params).parse(allocator, clap.args.OsIterator, &iter); | 118 | var args = try clap.ComptimeClap(clap.Help, ¶ms).parse(allocator, clap.args.OsIterator, &iter); |
| 119 | defer args.deinit(); | 119 | defer args.deinit(); |
| 120 | 120 | ||
| 121 | if (args.flag("--help")) | 121 | if (args.flag("--help")) |
| @@ -166,7 +166,7 @@ pub fn main() !void { | |||
| 166 | 166 | ||
| 167 | // Initialize our streaming parser. | 167 | // Initialize our streaming parser. |
| 168 | var parser = clap.StreamingClap(u8, clap.args.OsIterator){ | 168 | var parser = clap.StreamingClap(u8, clap.args.OsIterator){ |
| 169 | .params = params, | 169 | .params = ¶ms, |
| 170 | .iter = &iter, | 170 | .iter = &iter, |
| 171 | }; | 171 | }; |
| 172 | 172 | ||
| @@ -201,7 +201,7 @@ const std = @import("std"); | |||
| 201 | const clap = @import("clap"); | 201 | const clap = @import("clap"); |
| 202 | 202 | ||
| 203 | pub fn main() !void { | 203 | pub fn main() !void { |
| 204 | const stderr_file = try std.io.getStdErr(); | 204 | const stderr_file = std.io.getStdErr(); |
| 205 | var stderr_out_stream = stderr_file.outStream(); | 205 | var stderr_out_stream = stderr_file.outStream(); |
| 206 | const stderr = &stderr_out_stream.stream; | 206 | const stderr = &stderr_out_stream.stream; |
| 207 | 207 | ||
| @@ -210,7 +210,7 @@ pub fn main() !void { | |||
| 210 | // help message for any Param, but it is more verbose to call. | 210 | // help message for any Param, but it is more verbose to call. |
| 211 | try clap.help( | 211 | try clap.help( |
| 212 | stderr, | 212 | stderr, |
| 213 | comptime [_]clap.Param(clap.Help){ | 213 | comptime &[_]clap.Param(clap.Help){ |
| 214 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, | 214 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, |
| 215 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, | 215 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, |
| 216 | }, | 216 | }, |