diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -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 | } |