diff options
| author | 2024-10-24 17:47:48 +0200 | |
|---|---|---|
| committer | 2024-10-24 17:47:48 +0200 | |
| commit | 4ec4273a8a3b0ab02f1a7e49e971da8b5a71a034 (patch) | |
| tree | bbd2710a06f228e7e11692494daa9ccaa2a900af /README.md | |
| parent | docs: Add subcommand example (diff) | |
| download | zig-clap-4ec4273a8a3b0ab02f1a7e49e971da8b5a71a034.tar.gz zig-clap-4ec4273a8a3b0ab02f1a7e49e971da8b5a71a034.tar.xz zig-clap-4ec4273a8a3b0ab02f1a7e49e971da8b5a71a034.zip | |
fix: Subcommand example comments needs a scroll to be read
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -208,11 +208,11 @@ pub fn main() !void { | |||
| 208 | .diagnostic = &diag, | 208 | .diagnostic = &diag, |
| 209 | .allocator = gpa, | 209 | .allocator = gpa, |
| 210 | 210 | ||
| 211 | // Terminate the parsing of arguments after parsing the first positional (0 is passed here | 211 | // Terminate the parsing of arguments after parsing the first positional (0 is passed |
| 212 | // because parsed positionals are, like slices and arrays, indexed starting at 0). | 212 | // here because parsed positionals are, like slices and arrays, indexed starting at 0). |
| 213 | // | 213 | // |
| 214 | // This will terminate the parsing after parsing the subcommand enum and leave `iter` not | 214 | // This will terminate the parsing after parsing the subcommand enum and leave `iter` |
| 215 | // fully consumed. It can then be reused to parse the arguments for subcommands | 215 | // not fully consumed. It can then be reused to parse the arguments for subcommands |
| 216 | .terminating_positional = 0, | 216 | .terminating_positional = 0, |
| 217 | }) catch |err| { | 217 | }) catch |err| { |
| 218 | diag.report(std.io.getStdErr().writer(), err) catch {}; | 218 | diag.report(std.io.getStdErr().writer(), err) catch {}; |
| @@ -231,8 +231,8 @@ pub fn main() !void { | |||
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | fn mathMain(gpa: std.mem.Allocator, iter: *std.process.ArgIterator, main_args: MainArgs) !void { | 233 | fn mathMain(gpa: std.mem.Allocator, iter: *std.process.ArgIterator, main_args: MainArgs) !void { |
| 234 | // The parent arguments are not used it, but there are cases where it might be useful, so the | 234 | // The parent arguments are not used it, but there are cases where it might be useful, so |
| 235 | // example shows how to pass the arguments around. | 235 | // the example shows how to pass the arguments around. |
| 236 | _ = main_args; | 236 | _ = main_args; |
| 237 | 237 | ||
| 238 | // The parameters for the subcommand | 238 | // The parameters for the subcommand |