diff options
Diffstat (limited to 'clap.zig')
| -rw-r--r-- | clap.zig | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -74,7 +74,7 @@ pub fn parseParam(line: []const u8) !Param(Help) { | |||
| 74 | @setEvalBranchQuota(std.math.maxInt(u32)); | 74 | @setEvalBranchQuota(std.math.maxInt(u32)); |
| 75 | 75 | ||
| 76 | var found_comma = false; | 76 | var found_comma = false; |
| 77 | var it = mem.tokenize(line, " \t"); | 77 | var it = mem.tokenize(u8, line, " \t"); |
| 78 | var param_str = it.next() orelse return error.NoParamFound; | 78 | var param_str = it.next() orelse return error.NoParamFound; |
| 79 | 79 | ||
| 80 | const short_name = if (!mem.startsWith(u8, param_str, "--") and | 80 | const short_name = if (!mem.startsWith(u8, param_str, "--") and |
| @@ -337,7 +337,7 @@ pub const ParseOptions = struct { | |||
| 337 | /// `parse`, `parseEx` does not wrap the allocator so the heap allocator can be | 337 | /// `parse`, `parseEx` does not wrap the allocator so the heap allocator can be |
| 338 | /// quite expensive. (TODO: Can we pick a better default? For `parse`, this allocator | 338 | /// quite expensive. (TODO: Can we pick a better default? For `parse`, this allocator |
| 339 | /// is fine, as it wraps it in an arena) | 339 | /// is fine, as it wraps it in an arena) |
| 340 | allocator: *mem.Allocator = heap.page_allocator, | 340 | allocator: mem.Allocator = heap.page_allocator, |
| 341 | diagnostic: ?*Diagnostic = null, | 341 | diagnostic: ?*Diagnostic = null, |
| 342 | }; | 342 | }; |
| 343 | 343 | ||
| @@ -350,7 +350,7 @@ pub fn parse( | |||
| 350 | var iter = try args.OsIterator.init(opt.allocator); | 350 | var iter = try args.OsIterator.init(opt.allocator); |
| 351 | const clap = try parseEx(Id, params, &iter, .{ | 351 | const clap = try parseEx(Id, params, &iter, .{ |
| 352 | // Let's reuse the arena from the `OSIterator` since we already have it. | 352 | // Let's reuse the arena from the `OSIterator` since we already have it. |
| 353 | .allocator = &iter.arena.allocator, | 353 | .allocator = iter.arena.allocator(), |
| 354 | .diagnostic = opt.diagnostic, | 354 | .diagnostic = opt.diagnostic, |
| 355 | }); | 355 | }); |
| 356 | 356 | ||
| @@ -409,7 +409,7 @@ pub fn helpFull( | |||
| 409 | try printParam(cs.writer(), Id, param, Error, context, valueText); | 409 | try printParam(cs.writer(), Id, param, Error, context, valueText); |
| 410 | try stream.writeByteNTimes(' ', max_spacing - @intCast(usize, cs.bytes_written)); | 410 | try stream.writeByteNTimes(' ', max_spacing - @intCast(usize, cs.bytes_written)); |
| 411 | const help_text = try helpText(context, param); | 411 | const help_text = try helpText(context, param); |
| 412 | var help_text_line_it = mem.split(help_text, "\n"); | 412 | var help_text_line_it = mem.split(u8, help_text, "\n"); |
| 413 | var indent_line = false; | 413 | var indent_line = false; |
| 414 | while (help_text_line_it.next()) |line| : (indent_line = true) { | 414 | while (help_text_line_it.next()) |line| : (indent_line = true) { |
| 415 | if (indent_line) { | 415 | if (indent_line) { |