From 2df5a2abb89be57cbe48eaa920c19304d77b046c Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Sat, 17 Aug 2019 18:56:16 +0200 Subject: correct comptime-clap-error.zig example --- README.md | 12 +++++------- example/README.md.template | 6 +++--- example/comptime-clap-error.zig | 6 ++---- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 297764c..ce83cf0 100644 --- a/README.md +++ b/README.md @@ -133,14 +133,12 @@ const std = @import("std"); const clap = @import("clap"); pub fn main() !void { + const allocator = std.heap.direct_allocator; + const params = [_]clap.Param(void){clap.Param(void){ .names = clap.Names{ .short = 'h', .long = "help" }, }}; - var direct_allocator = std.heap.DirectAllocator.init(); - const allocator = &direct_allocator.allocator; - defer direct_allocator.deinit(); - var iter = clap.args.OsIterator.init(allocator); defer iter.deinit(); const exe = try iter.next(); @@ -154,13 +152,13 @@ pub fn main() !void { ``` ``` -zig-clap/src/comptime.zig:116:17: error: --helps is not a parameter. +zig-clap/src/comptime.zig:109:17: error: --helps is not a parameter. @compileError(name ++ " is not a parameter."); ^ -zig-clap/src/comptime.zig:84:45: note: called from here +zig-clap/src/comptime.zig:77:45: note: called from here const param = comptime findParam(name); ^ -zig-clap/example/comptime-clap-error.zig:22:18: note: called from here +zig-clap/example/comptime-clap-error.zig:18:18: note: called from here _ = args.flag("--helps"); ^ ``` 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: ``` ``` -zig-clap/src/comptime.zig:116:17: error: --helps is not a parameter. +zig-clap/src/comptime.zig:109:17: error: --helps is not a parameter. @compileError(name ++ " is not a parameter."); ^ -zig-clap/src/comptime.zig:84:45: note: called from here +zig-clap/src/comptime.zig:77:45: note: called from here const param = comptime findParam(name); ^ -zig-clap/example/comptime-clap-error.zig:22:18: note: called from here +zig-clap/example/comptime-clap-error.zig:18:18: note: called from here _ = args.flag("--helps"); ^ ``` 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"); const clap = @import("clap"); pub fn main() !void { + const allocator = std.heap.direct_allocator; + const params = [_]clap.Param(void){clap.Param(void){ .names = clap.Names{ .short = 'h', .long = "help" }, }}; - var direct_allocator = std.heap.DirectAllocator.init(); - const allocator = &direct_allocator.allocator; - defer direct_allocator.deinit(); - var iter = clap.args.OsIterator.init(allocator); defer iter.deinit(); const exe = try iter.next(); -- cgit v1.2.3