diff options
Diffstat (limited to 'clap.zig')
| -rw-r--r-- | clap.zig | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -648,16 +648,17 @@ pub fn parse( | |||
| 648 | comptime Id: type, | 648 | comptime Id: type, |
| 649 | comptime params: []const Param(Id), | 649 | comptime params: []const Param(Id), |
| 650 | comptime value_parsers: anytype, | 650 | comptime value_parsers: anytype, |
| 651 | arguments: std.process.Args, | ||
| 651 | opt: ParseOptions, | 652 | opt: ParseOptions, |
| 652 | ) !Result(Id, params, value_parsers) { | 653 | ) !Result(Id, params, value_parsers) { |
| 653 | var arena = std.heap.ArenaAllocator.init(opt.allocator); | 654 | var arena = std.heap.ArenaAllocator.init(opt.allocator); |
| 654 | errdefer arena.deinit(); | 655 | errdefer arena.deinit(); |
| 655 | 656 | ||
| 656 | var iter = try std.process.ArgIterator.initWithAllocator(arena.allocator()); | 657 | var iter = try arguments.iterateAllocator(arena.allocator()); |
| 657 | const exe_arg = iter.next(); | 658 | const exe_arg = iter.next(); |
| 658 | 659 | ||
| 659 | const result = try parseEx(Id, params, value_parsers, &iter, .{ | 660 | const result = try parseEx(Id, params, value_parsers, &iter, .{ |
| 660 | // Let's reuse the arena from the `ArgIterator` since we already have it. | 661 | // Let's reuse the arena from the `Args.Iterator` since we already have it. |
| 661 | .allocator = arena.allocator(), | 662 | .allocator = arena.allocator(), |
| 662 | .diagnostic = opt.diagnostic, | 663 | .diagnostic = opt.diagnostic, |
| 663 | .assignment_separators = opt.assignment_separators, | 664 | .assignment_separators = opt.assignment_separators, |