diff options
Diffstat (limited to 'example/simple-ex.zig')
| -rw-r--r-- | example/simple-ex.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/example/simple-ex.zig b/example/simple-ex.zig index 5653fd1..d2dc77e 100644 --- a/example/simple-ex.zig +++ b/example/simple-ex.zig | |||
| @@ -3,6 +3,7 @@ const std = @import("std"); | |||
| 3 | 3 | ||
| 4 | const debug = std.debug; | 4 | const debug = std.debug; |
| 5 | const io = std.io; | 5 | const io = std.io; |
| 6 | const process = std.process; | ||
| 6 | 7 | ||
| 7 | pub fn main() !void { | 8 | pub fn main() !void { |
| 8 | const allocator = std.heap.page_allocator; | 9 | const allocator = std.heap.page_allocator; |
| @@ -16,11 +17,12 @@ pub fn main() !void { | |||
| 16 | clap.parseParam("<POS>...") catch unreachable, | 17 | clap.parseParam("<POS>...") catch unreachable, |
| 17 | }; | 18 | }; |
| 18 | 19 | ||
| 19 | // We then initialize an argument iterator. We will use the OsIterator as it nicely | 20 | var iter = try process.ArgIterator.initWithAllocator(allocator); |
| 20 | // wraps iterating over arguments the most efficient way on each os. | ||
| 21 | var iter = try clap.args.OsIterator.init(allocator); | ||
| 22 | defer iter.deinit(); | 21 | defer iter.deinit(); |
| 23 | 22 | ||
| 23 | // Skip exe argument | ||
| 24 | _ = iter.next(); | ||
| 25 | |||
| 24 | // Initalize our diagnostics, which can be used for reporting useful errors. | 26 | // Initalize our diagnostics, which can be used for reporting useful errors. |
| 25 | // This is optional. You can also pass `.{}` to `clap.parse` if you don't | 27 | // This is optional. You can also pass `.{}` to `clap.parse` if you don't |
| 26 | // care about the extra information `Diagnostics` provides. | 28 | // care about the extra information `Diagnostics` provides. |