summaryrefslogtreecommitdiff
path: root/example/comptime-clap.zig
diff options
context:
space:
mode:
authorGravatar Jimmi HC2019-02-10 14:47:12 +0100
committerGravatar Jimmi HC2019-02-10 14:47:12 +0100
commit810ef3671d9c2cea5ce5524f51bf2d947a6cb5bf (patch)
tree90b8a1fa5276d23360fb7afcfb47083eda7a53b7 /example/comptime-clap.zig
parentUpdated to newest testing API (diff)
parentRemoved duplicate in readme (diff)
downloadzig-clap-810ef3671d9c2cea5ce5524f51bf2d947a6cb5bf.tar.gz
zig-clap-810ef3671d9c2cea5ce5524f51bf2d947a6cb5bf.tar.xz
zig-clap-810ef3671d9c2cea5ce5524f51bf2d947a6cb5bf.zip
Merge branch 'master' of github.com:Hejsil/zig-clap
Diffstat (limited to 'example/comptime-clap.zig')
-rw-r--r--example/comptime-clap.zig7
1 files changed, 3 insertions, 4 deletions
diff --git a/example/comptime-clap.zig b/example/comptime-clap.zig
index 00c2a97..8d2d8a8 100644
--- a/example/comptime-clap.zig
+++ b/example/comptime-clap.zig
@@ -27,15 +27,14 @@ pub fn main() !void {
27 27
28 // We then initialize an argument iterator. We will use the OsIterator as it nicely 28 // We then initialize an argument iterator. We will use the OsIterator as it nicely
29 // wraps iterating over arguments the most efficient way on each os. 29 // wraps iterating over arguments the most efficient way on each os.
30 var os_iter = clap.args.OsIterator.init(allocator); 30 var iter = clap.args.OsIterator.init(allocator);
31 const iter = &os_iter.iter; 31 defer iter.deinit();
32 defer os_iter.deinit();
33 32
34 // Consume the exe arg. 33 // Consume the exe arg.
35 const exe = try iter.next(); 34 const exe = try iter.next();
36 35
37 // Finally we can parse the arguments 36 // Finally we can parse the arguments
38 var args = try clap.ComptimeClap([]const u8, params).parse(allocator, clap.args.OsIterator.Error, iter); 37 var args = try clap.ComptimeClap([]const u8, params).parse(allocator, clap.args.OsIterator, &iter);
39 defer args.deinit(); 38 defer args.deinit();
40 39
41 // clap.help is a function that can print a simple help message, given a 40 // clap.help is a function that can print a simple help message, given a