summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorGravatar Jimmi Holst Christensen2019-08-17 18:56:16 +0200
committerGravatar Jimmi Holst Christensen2019-08-17 18:56:16 +0200
commit2df5a2abb89be57cbe48eaa920c19304d77b046c (patch)
tree9ab5a5fe2757e70b6836f211c4e96be127767e99 /example
parentrebuild readme (diff)
downloadzig-clap-2df5a2abb89be57cbe48eaa920c19304d77b046c.tar.gz
zig-clap-2df5a2abb89be57cbe48eaa920c19304d77b046c.tar.xz
zig-clap-2df5a2abb89be57cbe48eaa920c19304d77b046c.zip
correct comptime-clap-error.zig example
Diffstat (limited to '')
-rw-r--r--example/README.md.template6
-rw-r--r--example/comptime-clap-error.zig6
2 files changed, 5 insertions, 7 deletions
diff --git a/example/README.md.template b/example/README.md.template
index 7963112..373a037 100644
--- a/example/README.md.template
+++ b/example/README.md.template
@@ -42,13 +42,13 @@ program can take:
42``` 42```
43 43
44``` 44```
45zig-clap/src/comptime.zig:116:17: error: --helps is not a parameter. 45zig-clap/src/comptime.zig:109:17: error: --helps is not a parameter.
46 @compileError(name ++ " is not a parameter."); 46 @compileError(name ++ " is not a parameter.");
47 ^ 47 ^
48zig-clap/src/comptime.zig:84:45: note: called from here 48zig-clap/src/comptime.zig:77:45: note: called from here
49 const param = comptime findParam(name); 49 const param = comptime findParam(name);
50 ^ 50 ^
51zig-clap/example/comptime-clap-error.zig:22:18: note: called from here 51zig-clap/example/comptime-clap-error.zig:18:18: note: called from here
52 _ = args.flag("--helps"); 52 _ = args.flag("--helps");
53 ^ 53 ^
54``` 54```
diff --git a/example/comptime-clap-error.zig b/example/comptime-clap-error.zig
index 93c1af2..3209b74 100644
--- a/example/comptime-clap-error.zig
+++ b/example/comptime-clap-error.zig
@@ -2,14 +2,12 @@ const std = @import("std");
2const clap = @import("clap"); 2const clap = @import("clap");
3 3
4pub fn main() !void { 4pub fn main() !void {
5 const allocator = std.heap.direct_allocator;
6
5 const params = [_]clap.Param(void){clap.Param(void){ 7 const params = [_]clap.Param(void){clap.Param(void){
6 .names = clap.Names{ .short = 'h', .long = "help" }, 8 .names = clap.Names{ .short = 'h', .long = "help" },
7 }}; 9 }};
8 10
9 var direct_allocator = std.heap.DirectAllocator.init();
10 const allocator = &direct_allocator.allocator;
11 defer direct_allocator.deinit();
12
13 var iter = clap.args.OsIterator.init(allocator); 11 var iter = clap.args.OsIterator.init(allocator);
14 defer iter.deinit(); 12 defer iter.deinit();
15 const exe = try iter.next(); 13 const exe = try iter.next();