summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorGravatar Jimmi Holst Christensen2020-08-15 15:23:46 +0200
committerGravatar Jimmi Holst Christensen2020-08-15 15:24:19 +0200
commitddca24a6fd9a7d23d168b2195932a32b92a18b09 (patch)
tree07f9fd75fc032a3a823c86b128e82b47ec53470f /README.md
parentCreate FUNDING.yml (diff)
downloadzig-clap-ddca24a6fd9a7d23d168b2195932a32b92a18b09.tar.gz
zig-clap-ddca24a6fd9a7d23d168b2195932a32b92a18b09.tar.xz
zig-clap-ddca24a6fd9a7d23d168b2195932a32b92a18b09.zip
Fix expected type error on 32 bit systems
fixes #23
Diffstat (limited to '')
-rw-r--r--README.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/README.md b/README.md
index 2b38281..06d29c5 100644
--- a/README.md
+++ b/README.md
@@ -46,9 +46,9 @@ pub fn main() !void {
46 if (args.flag("--help")) 46 if (args.flag("--help"))
47 debug.warn("--help\n", .{}); 47 debug.warn("--help\n", .{});
48 if (args.option("--number")) |n| 48 if (args.option("--number")) |n|
49 debug.warn("--number = {}\n", .{ n }); 49 debug.warn("--number = {}\n", .{n});
50 for (args.positionals()) |pos| 50 for (args.positionals()) |pos|
51 debug.warn("{}\n", .{ pos }); 51 debug.warn("{}\n", .{pos});
52} 52}
53 53
54``` 54```
@@ -125,9 +125,9 @@ pub fn main() !void {
125 if (args.flag("--help")) 125 if (args.flag("--help"))
126 debug.warn("--help\n", .{}); 126 debug.warn("--help\n", .{});
127 if (args.option("--number")) |n| 127 if (args.option("--number")) |n|
128 debug.warn("--number = {}\n", .{ n }); 128 debug.warn("--number = {}\n", .{n});
129 for (args.positionals()) |pos| 129 for (args.positionals()) |pos|
130 debug.warn("{}\n", .{ pos }); 130 debug.warn("{}\n", .{pos});
131} 131}
132 132
133``` 133```
@@ -179,12 +179,12 @@ pub fn main() !void {
179 // arg.param will point to the parameter which matched the argument. 179 // arg.param will point to the parameter which matched the argument.
180 switch (arg.param.id) { 180 switch (arg.param.id) {
181 'h' => debug.warn("Help!\n", .{}), 181 'h' => debug.warn("Help!\n", .{}),
182 'n' => debug.warn("--number = {}\n", .{ arg.value.? }), 182 'n' => debug.warn("--number = {}\n", .{arg.value.?}),
183 183
184 // arg.value == null, if arg.param.takes_value == false. 184 // arg.value == null, if arg.param.takes_value == false.
185 // Otherwise, arg.value is the value passed with the argument, such as "-a=10" 185 // Otherwise, arg.value is the value passed with the argument, such as "-a=10"
186 // or "-a 10". 186 // or "-a 10".
187 'f' => debug.warn("{}\n", .{ arg.value.? }), 187 'f' => debug.warn("{}\n", .{arg.value.?}),
188 else => unreachable, 188 else => unreachable,
189 } 189 }
190 } 190 }