diff options
Diffstat (limited to 'clap.zig')
| -rw-r--r-- | clap.zig | 10 |
1 files changed, 10 insertions, 0 deletions
| @@ -63,6 +63,16 @@ pub fn Param(comptime Id: type) type { | |||
| 63 | /// Takes a string and parses it to a Param(Help). | 63 | /// Takes a string and parses it to a Param(Help). |
| 64 | /// This is the reverse of 'help' but for at single parameter only. | 64 | /// This is the reverse of 'help' but for at single parameter only. |
| 65 | pub fn parseParam(line: []const u8) !Param(Help) { | 65 | pub fn parseParam(line: []const u8) !Param(Help) { |
| 66 | // This function become a lot less ergonomic to use once you hit the eval branch quota. To | ||
| 67 | // avoid this we pick a sane default. Sadly, the only sane default is the biggest possible | ||
| 68 | // value. If we pick something a lot smaller and a user hits the quota after that, they have | ||
| 69 | // no way of overriding it, since we set it here. | ||
| 70 | // We can recosider this again if: | ||
| 71 | // * We get parseParams: https://github.com/Hejsil/zig-clap/issues/39 | ||
| 72 | // * We get a larger default branch quota in the zig compiler (stage 2). | ||
| 73 | // * Someone points out how this is a really bad idea. | ||
| 74 | @setEvalBranchQuota(std.math.maxInt(u32)); | ||
| 75 | |||
| 66 | var found_comma = false; | 76 | var found_comma = false; |
| 67 | var it = mem.tokenize(line, " \t"); | 77 | var it = mem.tokenize(line, " \t"); |
| 68 | var param_str = it.next() orelse return error.NoParamFound; | 78 | var param_str = it.next() orelse return error.NoParamFound; |