diff options
Diffstat (limited to 'example/comptime-clap.zig')
| -rw-r--r-- | example/comptime-clap.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/example/comptime-clap.zig b/example/comptime-clap.zig index 4d0ace3..f5c0221 100644 --- a/example/comptime-clap.zig +++ b/example/comptime-clap.zig | |||
| @@ -4,7 +4,7 @@ const clap = @import("clap"); | |||
| 4 | const debug = std.debug; | 4 | const debug = std.debug; |
| 5 | 5 | ||
| 6 | pub fn main() !void { | 6 | pub fn main() !void { |
| 7 | const allocator = std.heap.direct_allocator; | 7 | const allocator = std.heap.page_allocator; |
| 8 | 8 | ||
| 9 | // First we specify what parameters our program can take. | 9 | // First we specify what parameters our program can take. |
| 10 | // We can use `parseParam` to parse a string to a `Param(Help)` | 10 | // We can use `parseParam` to parse a string to a `Param(Help)` |
| @@ -22,13 +22,13 @@ pub fn main() !void { | |||
| 22 | defer iter.deinit(); | 22 | defer iter.deinit(); |
| 23 | 23 | ||
| 24 | // Parse the arguments | 24 | // Parse the arguments |
| 25 | var args = try clap.ComptimeClap(clap.Help, params).parse(allocator, clap.args.OsIterator, &iter); | 25 | var args = try clap.ComptimeClap(clap.Help, ¶ms).parse(allocator, clap.args.OsIterator, &iter); |
| 26 | defer args.deinit(); | 26 | defer args.deinit(); |
| 27 | 27 | ||
| 28 | if (args.flag("--help")) | 28 | if (args.flag("--help")) |
| 29 | debug.warn("--help\n"); | 29 | debug.warn("--help\n", .{}); |
| 30 | if (args.option("--number")) |n| | 30 | if (args.option("--number")) |n| |
| 31 | debug.warn("--number = {}\n", n); | 31 | debug.warn("--number = {}\n", .{ n }); |
| 32 | for (args.positionals()) |pos| | 32 | for (args.positionals()) |pos| |
| 33 | debug.warn("{}\n", pos); | 33 | debug.warn("{}\n", .{ pos }); |
| 34 | } | 34 | } |