diff options
| author | 2019-12-03 05:43:43 +0100 | |
|---|---|---|
| committer | 2019-12-03 05:43:43 +0100 | |
| commit | ac461f50df2861eb9b6834ba770c3c149c72eb9c (patch) | |
| tree | 7d76dca13427d585cff36c38230d368e51fb3c20 /example | |
| 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 'example')
| -rw-r--r-- | example/comptime-clap.zig | 2 | ||||
| -rw-r--r-- | example/help.zig | 4 | ||||
| -rw-r--r-- | example/simple-error.zig | 2 | ||||
| -rw-r--r-- | example/simple.zig | 2 | ||||
| -rw-r--r-- | example/streaming-clap.zig | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/example/comptime-clap.zig b/example/comptime-clap.zig index 4d0ace3..fde0648 100644 --- a/example/comptime-clap.zig +++ b/example/comptime-clap.zig | |||
| @@ -22,7 +22,7 @@ pub fn main() !void { | |||
| 22 | defer iter.deinit(); | 22 | defer iter.deinit(); |
| 23 | 23 | ||
| 24 | // Parse the arguments | 24 | // Parse the arguments |
| 25 | var args = try clap.ComptimeClap(clap.Help, params).parse(allocator, clap.args.OsIterator, &iter); | 25 | var args = try clap.ComptimeClap(clap.Help, ¶ms).parse(allocator, clap.args.OsIterator, &iter); |
| 26 | defer args.deinit(); | 26 | defer args.deinit(); |
| 27 | 27 | ||
| 28 | if (args.flag("--help")) | 28 | if (args.flag("--help")) |
diff --git a/example/help.zig b/example/help.zig index de8a55a..1191482 100644 --- a/example/help.zig +++ b/example/help.zig | |||
| @@ -2,7 +2,7 @@ const std = @import("std"); | |||
| 2 | const clap = @import("clap"); | 2 | const clap = @import("clap"); |
| 3 | 3 | ||
| 4 | pub fn main() !void { | 4 | pub fn main() !void { |
| 5 | const stderr_file = try std.io.getStdErr(); | 5 | const stderr_file = std.io.getStdErr(); |
| 6 | var stderr_out_stream = stderr_file.outStream(); | 6 | var stderr_out_stream = stderr_file.outStream(); |
| 7 | const stderr = &stderr_out_stream.stream; | 7 | const stderr = &stderr_out_stream.stream; |
| 8 | 8 | ||
| @@ -11,7 +11,7 @@ pub fn main() !void { | |||
| 11 | // help message for any Param, but it is more verbose to call. | 11 | // help message for any Param, but it is more verbose to call. |
| 12 | try clap.help( | 12 | try clap.help( |
| 13 | stderr, | 13 | stderr, |
| 14 | comptime [_]clap.Param(clap.Help){ | 14 | comptime &[_]clap.Param(clap.Help){ |
| 15 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, | 15 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, |
| 16 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, | 16 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, |
| 17 | }, | 17 | }, |
diff --git a/example/simple-error.zig b/example/simple-error.zig index fc72a03..2c403fc 100644 --- a/example/simple-error.zig +++ b/example/simple-error.zig | |||
| @@ -8,7 +8,7 @@ pub fn main() !void { | |||
| 8 | clap.parseParam("-h, --help Display this help and exit.") catch unreachable, | 8 | clap.parseParam("-h, --help Display this help and exit.") catch unreachable, |
| 9 | }; | 9 | }; |
| 10 | 10 | ||
| 11 | var args = try clap.parse(clap.Help, params, std.heap.direct_allocator); | 11 | var args = try clap.parse(clap.Help, ¶ms, std.heap.direct_allocator); |
| 12 | defer args.deinit(); | 12 | defer args.deinit(); |
| 13 | 13 | ||
| 14 | _ = args.flag("--helps"); | 14 | _ = args.flag("--helps"); |
diff --git a/example/simple.zig b/example/simple.zig index f791447..a3f27ea 100644 --- a/example/simple.zig +++ b/example/simple.zig | |||
| @@ -14,7 +14,7 @@ pub fn main() !void { | |||
| 14 | }, | 14 | }, |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | var args = try clap.parse(clap.Help, params, std.heap.direct_allocator); | 17 | var args = try clap.parse(clap.Help, ¶ms, std.heap.direct_allocator); |
| 18 | defer args.deinit(); | 18 | defer args.deinit(); |
| 19 | 19 | ||
| 20 | if (args.flag("--help")) | 20 | if (args.flag("--help")) |
diff --git a/example/streaming-clap.zig b/example/streaming-clap.zig index 0361d46..c9f20e2 100644 --- a/example/streaming-clap.zig +++ b/example/streaming-clap.zig | |||
| @@ -30,7 +30,7 @@ pub fn main() !void { | |||
| 30 | 30 | ||
| 31 | // Initialize our streaming parser. | 31 | // Initialize our streaming parser. |
| 32 | var parser = clap.StreamingClap(u8, clap.args.OsIterator){ | 32 | var parser = clap.StreamingClap(u8, clap.args.OsIterator){ |
| 33 | .params = params, | 33 | .params = ¶ms, |
| 34 | .iter = &iter, | 34 | .iter = &iter, |
| 35 | }; | 35 | }; |
| 36 | 36 | ||