From d83747d4d57b339ce2cc42b785436126a8e8c4c6 Mon Sep 17 00:00:00 2001 From: joachimschmidt557 Date: Sat, 11 Apr 2020 14:11:08 +0200 Subject: update examples to latest zig --- example/comptime-clap.zig | 2 +- example/help.zig | 3 +-- example/simple.zig | 2 +- example/streaming-clap.zig | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) (limited to 'example') diff --git a/example/comptime-clap.zig b/example/comptime-clap.zig index a030368..f5c0221 100644 --- a/example/comptime-clap.zig +++ b/example/comptime-clap.zig @@ -4,7 +4,7 @@ const clap = @import("clap"); const debug = std.debug; pub fn main() !void { - const allocator = std.heap.direct_allocator; + const allocator = std.heap.page_allocator; // First we specify what parameters our program can take. // We can use `parseParam` to parse a string to a `Param(Help)` diff --git a/example/help.zig b/example/help.zig index 1191482..2775177 100644 --- a/example/help.zig +++ b/example/help.zig @@ -4,13 +4,12 @@ const clap = @import("clap"); pub fn main() !void { const stderr_file = std.io.getStdErr(); var stderr_out_stream = stderr_file.outStream(); - const stderr = &stderr_out_stream.stream; // clap.help is a function that can print a simple help message, given a // slice of Param(Help). There is also a helpEx, which can print a // help message for any Param, but it is more verbose to call. try clap.help( - stderr, + stderr_out_stream, comptime &[_]clap.Param(clap.Help){ clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, clap.parseParam("-v, --version Output version information and exit.") catch unreachable, diff --git a/example/simple.zig b/example/simple.zig index 5ac204d..d546223 100644 --- a/example/simple.zig +++ b/example/simple.zig @@ -14,7 +14,7 @@ pub fn main() !void { }, }; - var args = try clap.parse(clap.Help, ¶ms, std.heap.direct_allocator); + var args = try clap.parse(clap.Help, ¶ms, std.heap.page_allocator); defer args.deinit(); if (args.flag("--help")) diff --git a/example/streaming-clap.zig b/example/streaming-clap.zig index b277266..4cc43d1 100644 --- a/example/streaming-clap.zig +++ b/example/streaming-clap.zig @@ -4,7 +4,7 @@ const clap = @import("clap"); const debug = std.debug; pub fn main() !void { - const allocator = std.heap.direct_allocator; + const allocator = std.heap.page_allocator; // First we specify what parameters our program can take. const params = [_]clap.Param(u8){ -- cgit v1.2.3