diff options
| author | 2019-08-06 18:38:56 +0200 | |
|---|---|---|
| committer | 2019-08-06 18:38:56 +0200 | |
| commit | bf18f2a1f72570aca94a6d3e4703f5f54a2e090b (patch) | |
| tree | d06d34639f8d8d69830719be22d7c79d6875814a /README.md | |
| parent | Embed examples in README during build (diff) | |
| download | zig-clap-bf18f2a1f72570aca94a6d3e4703f5f54a2e090b.tar.gz zig-clap-bf18f2a1f72570aca94a6d3e4703f5f54a2e090b.tar.xz zig-clap-bf18f2a1f72570aca94a6d3e4703f5f54a2e090b.zip | |
build with latest version of zig
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 24 |
1 files changed, 7 insertions, 17 deletions
| @@ -25,9 +25,7 @@ const clap = @import("clap"); | |||
| 25 | const debug = std.debug; | 25 | const debug = std.debug; |
| 26 | 26 | ||
| 27 | pub fn main() !void { | 27 | pub fn main() !void { |
| 28 | var direct_allocator = std.heap.DirectAllocator.init(); | 28 | const allocator = std.heap.direct_allocator; |
| 29 | const allocator = &direct_allocator.allocator; | ||
| 30 | defer direct_allocator.deinit(); | ||
| 31 | 29 | ||
| 32 | // First we specify what parameters our program can take. | 30 | // First we specify what parameters our program can take. |
| 33 | const params = [_]clap.Param(u8){ | 31 | const params = [_]clap.Param(u8){ |
| @@ -90,13 +88,7 @@ const clap = @import("clap"); | |||
| 90 | const debug = std.debug; | 88 | const debug = std.debug; |
| 91 | 89 | ||
| 92 | pub fn main() !void { | 90 | pub fn main() !void { |
| 93 | const stdout_file = try std.io.getStdOut(); | 91 | const allocator = std.heap.direct_allocator; |
| 94 | var stdout_out_stream = stdout_file.outStream(); | ||
| 95 | const stdout = &stdout_out_stream.stream; | ||
| 96 | |||
| 97 | var direct_allocator = std.heap.DirectAllocator.init(); | ||
| 98 | const allocator = &direct_allocator.allocator; | ||
| 99 | defer direct_allocator.deinit(); | ||
| 100 | 92 | ||
| 101 | // First we specify what parameters our program can take. | 93 | // First we specify what parameters our program can take. |
| 102 | const params = [_]clap.Param([]const u8){ | 94 | const params = [_]clap.Param([]const u8){ |
| @@ -146,11 +138,9 @@ const std = @import("std"); | |||
| 146 | const clap = @import("clap"); | 138 | const clap = @import("clap"); |
| 147 | 139 | ||
| 148 | pub fn main() !void { | 140 | pub fn main() !void { |
| 149 | const params = [_]clap.Param(void){ | 141 | const params = [_]clap.Param(void){clap.Param(void){ |
| 150 | clap.Param(void){ | 142 | .names = clap.Names{ .short = 'h', .long = "help" }, |
| 151 | .names = clap.Names{ .short = 'h', .long = "help" } | 143 | }}; |
| 152 | }, | ||
| 153 | }; | ||
| 154 | 144 | ||
| 155 | var direct_allocator = std.heap.DirectAllocator.init(); | 145 | var direct_allocator = std.heap.DirectAllocator.init(); |
| 156 | const allocator = &direct_allocator.allocator; | 146 | const allocator = &direct_allocator.allocator; |
| @@ -204,11 +194,11 @@ pub fn main() !void { | |||
| 204 | [_]clap.Param([]const u8){ | 194 | [_]clap.Param([]const u8){ |
| 205 | clap.Param([]const u8){ | 195 | clap.Param([]const u8){ |
| 206 | .id = "Display this help and exit.", | 196 | .id = "Display this help and exit.", |
| 207 | .names = clap.Names{ .short = 'h', .long = "help" } | 197 | .names = clap.Names{ .short = 'h', .long = "help" }, |
| 208 | }, | 198 | }, |
| 209 | clap.Param([]const u8){ | 199 | clap.Param([]const u8){ |
| 210 | .id = "Output version information and exit.", | 200 | .id = "Output version information and exit.", |
| 211 | .names = clap.Names{ .short = 'v', .long = "version" } | 201 | .names = clap.Names{ .short = 'v', .long = "version" }, |
| 212 | }, | 202 | }, |
| 213 | }, | 203 | }, |
| 214 | ); | 204 | ); |