diff options
| -rw-r--r-- | clap.zig | 20 |
1 files changed, 9 insertions, 11 deletions
| @@ -293,19 +293,17 @@ pub fn parse( | |||
| 293 | opt: ParseOptions, | 293 | opt: ParseOptions, |
| 294 | ) !Args(Id, params) { | 294 | ) !Args(Id, params) { |
| 295 | var iter = try args.OsIterator.init(opt.allocator); | 295 | var iter = try args.OsIterator.init(opt.allocator); |
| 296 | var res = Args(Id, params){ | 296 | const clap = try parseEx(Id, params, &iter, .{ |
| 297 | .arena = iter.arena, | 297 | // Let's reuse the arena from the `OSIterator` since we already have it. |
| 298 | .exe_arg = iter.exe_arg, | 298 | .allocator = &iter.arena.allocator, |
| 299 | .clap = undefined, | ||
| 300 | }; | ||
| 301 | |||
| 302 | // Let's reuse the arena from the `OSIterator` since we already have | ||
| 303 | // it. | ||
| 304 | res.clap = try parseEx(Id, params, &iter, .{ | ||
| 305 | .allocator = &res.arena.allocator, | ||
| 306 | .diagnostic = opt.diagnostic, | 299 | .diagnostic = opt.diagnostic, |
| 307 | }); | 300 | }); |
| 308 | return res; | 301 | |
| 302 | return Args(Id, params){ | ||
| 303 | .exe_arg = iter.exe_arg, | ||
| 304 | .arena = iter.arena, | ||
| 305 | .clap = clap, | ||
| 306 | }; | ||
| 309 | } | 307 | } |
| 310 | 308 | ||
| 311 | /// Parses the command line arguments passed into the program based on an | 309 | /// Parses the command line arguments passed into the program based on an |