diff options
| author | 2019-02-10 14:47:12 +0100 | |
|---|---|---|
| committer | 2019-02-10 14:47:12 +0100 | |
| commit | 810ef3671d9c2cea5ce5524f51bf2d947a6cb5bf (patch) | |
| tree | 90b8a1fa5276d23360fb7afcfb47083eda7a53b7 /example/streaming-clap.zig | |
| parent | Updated to newest testing API (diff) | |
| parent | Removed duplicate in readme (diff) | |
| download | zig-clap-810ef3671d9c2cea5ce5524f51bf2d947a6cb5bf.tar.gz zig-clap-810ef3671d9c2cea5ce5524f51bf2d947a6cb5bf.tar.xz zig-clap-810ef3671d9c2cea5ce5524f51bf2d947a6cb5bf.zip | |
Merge branch 'master' of github.com:Hejsil/zig-clap
Diffstat (limited to '')
| -rw-r--r-- | example/streaming-clap.zig | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/example/streaming-clap.zig b/example/streaming-clap.zig index 77d05e2..aad3e71 100644 --- a/example/streaming-clap.zig +++ b/example/streaming-clap.zig | |||
| @@ -17,15 +17,14 @@ pub fn main() !void { | |||
| 17 | 17 | ||
| 18 | // We then initialize an argument iterator. We will use the OsIterator as it nicely | 18 | // We then initialize an argument iterator. We will use the OsIterator as it nicely |
| 19 | // wraps iterating over arguments the most efficient way on each os. | 19 | // wraps iterating over arguments the most efficient way on each os. |
| 20 | var os_iter = clap.args.OsIterator.init(allocator); | 20 | var iter = clap.args.OsIterator.init(allocator); |
| 21 | const iter = &os_iter.iter; | 21 | defer iter.deinit(); |
| 22 | defer os_iter.deinit(); | ||
| 23 | 22 | ||
| 24 | // Consume the exe arg. | 23 | // Consume the exe arg. |
| 25 | const exe = try iter.next(); | 24 | const exe = try iter.next(); |
| 26 | 25 | ||
| 27 | // Finally we initialize our streaming parser. | 26 | // Finally we initialize our streaming parser. |
| 28 | var parser = clap.StreamingClap(u8, clap.args.OsIterator.Error).init(params, iter); | 27 | var parser = clap.StreamingClap(u8, clap.args.OsIterator).init(params, &iter); |
| 29 | 28 | ||
| 30 | // Because we use a streaming parser, we have to consume each argument parsed individually. | 29 | // Because we use a streaming parser, we have to consume each argument parsed individually. |
| 31 | while (try parser.next()) |arg| { | 30 | while (try parser.next()) |arg| { |