summaryrefslogtreecommitdiff
path: root/example/comptime-clap.zig
diff options
context:
space:
mode:
Diffstat (limited to 'example/comptime-clap.zig')
-rw-r--r--example/comptime-clap.zig24
1 files changed, 14 insertions, 10 deletions
diff --git a/example/comptime-clap.zig b/example/comptime-clap.zig
index 8d2d8a8..935381f 100644
--- a/example/comptime-clap.zig
+++ b/example/comptime-clap.zig
@@ -13,16 +13,20 @@ pub fn main() !void {
13 defer direct_allocator.deinit(); 13 defer direct_allocator.deinit();
14 14
15 // First we specify what parameters our program can take. 15 // First we specify what parameters our program can take.
16 const params = comptime []clap.Param([]const u8){ 16 const params = comptime [_]clap.Param([]const u8){
17 clap.Param([]const u8).flag( 17 clap.Param([]const u8){
18 "Display this help and exit.", 18 .id = "Display this help and exit.",
19 clap.Names.both("help"), 19 .names = clap.Names{ .short = 'h', .long = "help" },
20 ), 20 },
21 clap.Param([]const u8).option( 21 clap.Param([]const u8){
22 "An option parameter, which takes a value.", 22 .id = "An option parameter, which takes a value.",
23 clap.Names.both("number"), 23 .names = clap.Names{ .short = 'n', .long = "number" },
24 ), 24 .takes_value = true,
25 clap.Param([]const u8).positional(""), 25 },
26 clap.Param([]const u8){
27 .id = "",
28 .takes_value = true,
29 },
26 }; 30 };
27 31
28 // We then initialize an argument iterator. We will use the OsIterator as it nicely 32 // We then initialize an argument iterator. We will use the OsIterator as it nicely