diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 12 |
1 files changed, 5 insertions, 7 deletions
| @@ -133,14 +133,12 @@ const std = @import("std"); | |||
| 133 | const clap = @import("clap"); | 133 | const clap = @import("clap"); |
| 134 | 134 | ||
| 135 | pub fn main() !void { | 135 | pub fn main() !void { |
| 136 | const allocator = std.heap.direct_allocator; | ||
| 137 | |||
| 136 | const params = [_]clap.Param(void){clap.Param(void){ | 138 | const params = [_]clap.Param(void){clap.Param(void){ |
| 137 | .names = clap.Names{ .short = 'h', .long = "help" }, | 139 | .names = clap.Names{ .short = 'h', .long = "help" }, |
| 138 | }}; | 140 | }}; |
| 139 | 141 | ||
| 140 | var direct_allocator = std.heap.DirectAllocator.init(); | ||
| 141 | const allocator = &direct_allocator.allocator; | ||
| 142 | defer direct_allocator.deinit(); | ||
| 143 | |||
| 144 | var iter = clap.args.OsIterator.init(allocator); | 142 | var iter = clap.args.OsIterator.init(allocator); |
| 145 | defer iter.deinit(); | 143 | defer iter.deinit(); |
| 146 | const exe = try iter.next(); | 144 | const exe = try iter.next(); |
| @@ -154,13 +152,13 @@ pub fn main() !void { | |||
| 154 | ``` | 152 | ``` |
| 155 | 153 | ||
| 156 | ``` | 154 | ``` |
| 157 | zig-clap/src/comptime.zig:116:17: error: --helps is not a parameter. | 155 | zig-clap/src/comptime.zig:109:17: error: --helps is not a parameter. |
| 158 | @compileError(name ++ " is not a parameter."); | 156 | @compileError(name ++ " is not a parameter."); |
| 159 | ^ | 157 | ^ |
| 160 | zig-clap/src/comptime.zig:84:45: note: called from here | 158 | zig-clap/src/comptime.zig:77:45: note: called from here |
| 161 | const param = comptime findParam(name); | 159 | const param = comptime findParam(name); |
| 162 | ^ | 160 | ^ |
| 163 | zig-clap/example/comptime-clap-error.zig:22:18: note: called from here | 161 | zig-clap/example/comptime-clap-error.zig:18:18: note: called from here |
| 164 | _ = args.flag("--helps"); | 162 | _ = args.flag("--helps"); |
| 165 | ^ | 163 | ^ |
| 166 | ``` | 164 | ``` |