summaryrefslogtreecommitdiff
path: root/example/help.zig
diff options
context:
space:
mode:
Diffstat (limited to 'example/help.zig')
-rw-r--r--example/help.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/example/help.zig b/example/help.zig
index a4379de..b07bc52 100644
--- a/example/help.zig
+++ b/example/help.zig
@@ -1,6 +1,10 @@
1pub fn main() !void { 1pub fn main() !void {
2 var gpa = std.heap.DebugAllocator(.{}){}; 2 var gpa_state = std.heap.DebugAllocator(.{}){};
3 defer _ = gpa.deinit(); 3 const gpa = gpa_state.allocator();
4 defer _ = gpa_state.deinit();
5
6 var threaded: std.Io.Threaded = .init_single_threaded;
7 const io: std.Io = threaded.io();
4 8
5 const params = comptime clap.parseParamsComptime( 9 const params = comptime clap.parseParamsComptime(
6 \\-h, --help Display this help and exit. 10 \\-h, --help Display this help and exit.
@@ -8,13 +12,9 @@ pub fn main() !void {
8 \\ 12 \\
9 ); 13 );
10 14
11 var res = try clap.parse(clap.Help, &params, clap.parsers.default, .{ 15 var res = try clap.parse(clap.Help, &params, clap.parsers.default, .{ .allocator = gpa });
12 .allocator = gpa.allocator(),
13 });
14 defer res.deinit(); 16 defer res.deinit();
15 17
16 var threaded: std.Io.Threaded = .init_single_threaded;
17 const io: std.Io = threaded.io();
18 // `clap.help` is a function that can print a simple help message. It can print any `Param` 18 // `clap.help` is a function that can print a simple help message. It can print any `Param`
19 // where `Id` has a `description` and `value` method (`Param(Help)` is one such parameter). 19 // where `Id` has a `description` and `value` method (`Param(Help)` is one such parameter).
20 // The last argument contains options as to how `help` should print those parameters. Using 20 // The last argument contains options as to how `help` should print those parameters. Using