diff options
Diffstat (limited to 'example')
| -rw-r--r-- | example/comptime-clap.zig | 7 | ||||
| -rw-r--r-- | example/streaming-clap.zig | 7 |
2 files changed, 4 insertions, 10 deletions
diff --git a/example/comptime-clap.zig b/example/comptime-clap.zig index 8e0eb12..4d0ace3 100644 --- a/example/comptime-clap.zig +++ b/example/comptime-clap.zig | |||
| @@ -18,13 +18,10 @@ pub fn main() !void { | |||
| 18 | 18 | ||
| 19 | // We then initialize an argument iterator. We will use the OsIterator as it nicely | 19 | // We then initialize an argument iterator. We will use the OsIterator as it nicely |
| 20 | // wraps iterating over arguments the most efficient way on each os. | 20 | // wraps iterating over arguments the most efficient way on each os. |
| 21 | var iter = clap.args.OsIterator.init(allocator); | 21 | var iter = try clap.args.OsIterator.init(allocator); |
| 22 | defer iter.deinit(); | 22 | defer iter.deinit(); |
| 23 | 23 | ||
| 24 | // Consume the exe arg. | 24 | // Parse the arguments |
| 25 | const exe = try iter.next(); | ||
| 26 | |||
| 27 | // Finally we can parse the arguments | ||
| 28 | var args = try clap.ComptimeClap(clap.Help, params).parse(allocator, clap.args.OsIterator, &iter); | 25 | var args = try clap.ComptimeClap(clap.Help, params).parse(allocator, clap.args.OsIterator, &iter); |
| 29 | defer args.deinit(); | 26 | defer args.deinit(); |
| 30 | 27 | ||
diff --git a/example/streaming-clap.zig b/example/streaming-clap.zig index d15e5b7..0361d46 100644 --- a/example/streaming-clap.zig +++ b/example/streaming-clap.zig | |||
| @@ -25,13 +25,10 @@ pub fn main() !void { | |||
| 25 | 25 | ||
| 26 | // We then initialize an argument iterator. We will use the OsIterator as it nicely | 26 | // We then initialize an argument iterator. We will use the OsIterator as it nicely |
| 27 | // wraps iterating over arguments the most efficient way on each os. | 27 | // wraps iterating over arguments the most efficient way on each os. |
| 28 | var iter = clap.args.OsIterator.init(allocator); | 28 | var iter = try clap.args.OsIterator.init(allocator); |
| 29 | defer iter.deinit(); | 29 | defer iter.deinit(); |
| 30 | 30 | ||
| 31 | // Consume the exe arg. | 31 | // Initialize our streaming parser. |
| 32 | const exe = try iter.next(); | ||
| 33 | |||
| 34 | // Finally we initialize our streaming parser. | ||
| 35 | var parser = clap.StreamingClap(u8, clap.args.OsIterator){ | 32 | var parser = clap.StreamingClap(u8, clap.args.OsIterator){ |
| 36 | .params = params, | 33 | .params = params, |
| 37 | .iter = &iter, | 34 | .iter = &iter, |