diff options
| author | 2025-09-22 05:14:09 +0900 | |
|---|---|---|
| committer | 2025-09-22 13:44:57 +0200 | |
| commit | b7e3348ed60f99ba32c75aa707ff7c87adc31b36 (patch) | |
| tree | 7113f8319fdee4eb7fd7e10a8bf33484c001578a | |
| parent | fix: use `usageToFile` in usage example (diff) | |
| download | zig-clap-b7e3348ed60f99ba32c75aa707ff7c87adc31b36.tar.gz zig-clap-b7e3348ed60f99ba32c75aa707ff7c87adc31b36.tar.xz zig-clap-b7e3348ed60f99ba32c75aa707ff7c87adc31b36.zip | |
fix: typos and minor grammar
| -rw-r--r-- | README.md | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -31,7 +31,7 @@ exe.root_module.addImport("clap", clap.module("clap")); | |||
| 31 | ## Features | 31 | ## Features |
| 32 | 32 | ||
| 33 | - Short arguments `-a` | 33 | - Short arguments `-a` |
| 34 | - Chaining `-abc` where `a` and `b` does not take values. | 34 | - Chaining `-abc` where `a` and `b` do not take values. |
| 35 | - Multiple specifications are tallied (e.g. `-v -v`). | 35 | - Multiple specifications are tallied (e.g. `-v -v`). |
| 36 | - Long arguments `--long` | 36 | - Long arguments `--long` |
| 37 | - Supports both passing values using spacing and `=` (`-a 100`, `-a=100`) | 37 | - Supports both passing values using spacing and `=` (`-a 100`, `-a=100`) |
| @@ -70,7 +70,7 @@ pub fn main() !void { | |||
| 70 | 70 | ||
| 71 | // Initialize our diagnostics, which can be used for reporting useful errors. | 71 | // Initialize our diagnostics, which can be used for reporting useful errors. |
| 72 | // This is optional. You can also pass `.{}` to `clap.parse` if you don't | 72 | // This is optional. You can also pass `.{}` to `clap.parse` if you don't |
| 73 | // care about the extra information `Diagnostics` provides. | 73 | // care about the extra information `Diagnostic` provides. |
| 74 | var diag = clap.Diagnostic{}; | 74 | var diag = clap.Diagnostic{}; |
| 75 | var res = clap.parse(clap.Help, ¶ms, clap.parsers.default, .{ | 75 | var res = clap.parse(clap.Help, ¶ms, clap.parsers.default, .{ |
| 76 | .diagnostic = &diag, | 76 | .diagnostic = &diag, |
| @@ -100,7 +100,7 @@ The result will contain an `args` field and a `positionals` field. `args` will h | |||
| 100 | each non-positional parameter of your program. The name of the field will be the longest name of the | 100 | each non-positional parameter of your program. The name of the field will be the longest name of the |
| 101 | parameter. `positionals` will be a tuple with one field for each positional parameter. | 101 | parameter. `positionals` will be a tuple with one field for each positional parameter. |
| 102 | 102 | ||
| 103 | The fields in `args` and `postionals` are typed. The type is based on the name of the value the | 103 | The fields in `args` and `positionals` are typed. The type is based on the name of the value the |
| 104 | parameter takes. Since `--number` takes a `usize` the field `res.args.number` has the type `usize`. | 104 | parameter takes. Since `--number` takes a `usize` the field `res.args.number` has the type `usize`. |
| 105 | 105 | ||
| 106 | Note that this is only the case because `clap.parsers.default` has a field called `usize` which | 106 | Note that this is only the case because `clap.parsers.default` has a field called `usize` which |
| @@ -342,7 +342,7 @@ runtime. | |||
| 342 | ### `help` | 342 | ### `help` |
| 343 | 343 | ||
| 344 | `help` prints a simple list of all parameters the program can take. It expects the `Id` to have a | 344 | `help` prints a simple list of all parameters the program can take. It expects the `Id` to have a |
| 345 | `description` method and an `value` method so that it can provide that in the output. `HelpOptions` | 345 | `description` method and a `value` method so that it can provide that in the output. `HelpOptions` |
| 346 | is passed to `help` to control how the help message is printed. | 346 | is passed to `help` to control how the help message is printed. |
| 347 | 347 | ||
| 348 | ```zig | 348 | ```zig |