diff options
| -rw-r--r-- | README.md | 9 | ||||
| -rw-r--r-- | build.zig | 2 |
2 files changed, 5 insertions, 6 deletions
| @@ -36,7 +36,7 @@ pub fn main() !void { | |||
| 36 | }, | 36 | }, |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | var args = try clap.parse(clap.Help, ¶ms, std.heap.direct_allocator); | 39 | var args = try clap.parse(clap.Help, ¶ms, std.heap.page_allocator); |
| 40 | defer args.deinit(); | 40 | defer args.deinit(); |
| 41 | 41 | ||
| 42 | if (args.flag("--help")) | 42 | if (args.flag("--help")) |
| @@ -97,7 +97,7 @@ const clap = @import("clap"); | |||
| 97 | const debug = std.debug; | 97 | const debug = std.debug; |
| 98 | 98 | ||
| 99 | pub fn main() !void { | 99 | pub fn main() !void { |
| 100 | const allocator = std.heap.direct_allocator; | 100 | const allocator = std.heap.page_allocator; |
| 101 | 101 | ||
| 102 | // First we specify what parameters our program can take. | 102 | // First we specify what parameters our program can take. |
| 103 | // We can use `parseParam` to parse a string to a `Param(Help)` | 103 | // We can use `parseParam` to parse a string to a `Param(Help)` |
| @@ -140,7 +140,7 @@ const clap = @import("clap"); | |||
| 140 | const debug = std.debug; | 140 | const debug = std.debug; |
| 141 | 141 | ||
| 142 | pub fn main() !void { | 142 | pub fn main() !void { |
| 143 | const allocator = std.heap.direct_allocator; | 143 | const allocator = std.heap.page_allocator; |
| 144 | 144 | ||
| 145 | // First we specify what parameters our program can take. | 145 | // First we specify what parameters our program can take. |
| 146 | const params = [_]clap.Param(u8){ | 146 | const params = [_]clap.Param(u8){ |
| @@ -203,13 +203,12 @@ const clap = @import("clap"); | |||
| 203 | pub fn main() !void { | 203 | pub fn main() !void { |
| 204 | const stderr_file = std.io.getStdErr(); | 204 | const stderr_file = std.io.getStdErr(); |
| 205 | var stderr_out_stream = stderr_file.outStream(); | 205 | var stderr_out_stream = stderr_file.outStream(); |
| 206 | const stderr = &stderr_out_stream.stream; | ||
| 207 | 206 | ||
| 208 | // clap.help is a function that can print a simple help message, given a | 207 | // clap.help is a function that can print a simple help message, given a |
| 209 | // slice of Param(Help). There is also a helpEx, which can print a | 208 | // slice of Param(Help). There is also a helpEx, which can print a |
| 210 | // help message for any Param, but it is more verbose to call. | 209 | // help message for any Param, but it is more verbose to call. |
| 211 | try clap.help( | 210 | try clap.help( |
| 212 | stderr, | 211 | stderr_out_stream, |
| 213 | comptime &[_]clap.Param(clap.Help){ | 212 | comptime &[_]clap.Param(clap.Help){ |
| 214 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, | 213 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, |
| 215 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, | 214 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, |
| @@ -40,7 +40,7 @@ pub fn build(b: *Builder) void { | |||
| 40 | example_step.dependOn(&example.step); | 40 | example_step.dependOn(&example.step); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | const readme_step = b.step("test", "Remake README."); | 43 | const readme_step = b.step("readme", "Remake README."); |
| 44 | const readme = readMeStep(b); | 44 | const readme = readMeStep(b); |
| 45 | readme.dependOn(example_step); | 45 | readme.dependOn(example_step); |
| 46 | readme_step.dependOn(readme); | 46 | readme_step.dependOn(readme); |