From 7188a9fc85f6aa0f71a4cb7966f8b0a044f29e02 Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Mon, 31 Jan 2022 17:11:15 +0100 Subject: Refactor the ArgIterator interface They now follow the interface provided by the standard library. This now means that we no longer needs `args.OsIterator` as that the one from `std` can now be used directly. Also remove `args.ShellIterator` as a simular iterator exists in `std` called `ArgIteratorGeneral`. --- example/simple-ex.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'example/simple-ex.zig') 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"); const debug = std.debug; const io = std.io; +const process = std.process; pub fn main() !void { const allocator = std.heap.page_allocator; @@ -16,11 +17,12 @@ pub fn main() !void { clap.parseParam("...") catch unreachable, }; - // We then initialize an argument iterator. We will use the OsIterator as it nicely - // wraps iterating over arguments the most efficient way on each os. - var iter = try clap.args.OsIterator.init(allocator); + var iter = try process.ArgIterator.initWithAllocator(allocator); defer iter.deinit(); + // Skip exe argument + _ = iter.next(); + // Initalize our diagnostics, which can be used for reporting useful errors. // This is optional. You can also pass `.{}` to `clap.parse` if you don't // care about the extra information `Diagnostics` provides. -- cgit v1.2.3