diff options
Diffstat (limited to 'example/README.md.template')
| -rw-r--r-- | example/README.md.template | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/example/README.md.template b/example/README.md.template index bcd3774..bbf5cb8 100644 --- a/example/README.md.template +++ b/example/README.md.template | |||
| @@ -45,8 +45,8 @@ exe.root_module.addImport("clap", clap.module("clap")); | |||
| 45 | 45 | ||
| 46 | ## API Reference | 46 | ## API Reference |
| 47 | 47 | ||
| 48 | Automatically generated API Reference for the project | 48 | Automatically generated API Reference for the project can be found at https://Hejsil.github.io/ |
| 49 | can be found at https://Hejsil.github.io/zig-clap. | 49 | zig-clap. |
| 50 | Note that Zig autodoc is in beta; the website may be broken or incomplete. | 50 | Note that Zig autodoc is in beta; the website may be broken or incomplete. |
| 51 | 51 | ||
| 52 | ## Examples | 52 | ## Examples |
| @@ -59,16 +59,16 @@ The simplest way to use this library is to just call the `clap.parse` function. | |||
| 59 | {s} | 59 | {s} |
| 60 | ``` | 60 | ``` |
| 61 | 61 | ||
| 62 | The result will contain an `args` field and a `positionals` field. `args` will have one field | 62 | The result will contain an `args` field and a `positionals` field. `args` will have one field for |
| 63 | for each none positional parameter of your program. The name of the field will be the longest | 63 | each non-positional parameter of your program. The name of the field will be the longest name of the |
| 64 | name of the parameter. `positionals` be a tuple with one field for each positional parameter. | 64 | parameter. `positionals` will be a tuple with one field for each positional parameter. |
| 65 | 65 | ||
| 66 | The fields in `args` and `postionals` are typed. The type is based on the name of the value the | 66 | The fields in `args` and `postionals` are typed. The type is based on the name of the value the |
| 67 | parameter takes. Since `--number` takes a `usize` the field `res.args.number` has the type `usize`. | 67 | parameter takes. Since `--number` takes a `usize` the field `res.args.number` has the type `usize`. |
| 68 | 68 | ||
| 69 | Note that this is only the case because `clap.parsers.default` has a field called `usize` which | 69 | Note that this is only the case because `clap.parsers.default` has a field called `usize` which |
| 70 | contains a parser that returns `usize`. You can pass in something other than | 70 | contains a parser that returns `usize`. You can pass in something other than `clap.parsers.default` |
| 71 | `clap.parsers.default` if you want some other mapping. | 71 | if you want some other mapping. |
| 72 | 72 | ||
| 73 | ```zig | 73 | ```zig |
| 74 | {s} | 74 | {s} |
| @@ -92,15 +92,13 @@ The `streaming.Clap` is the base of all the other parsers. It's a streaming pars | |||
| 92 | {s} | 92 | {s} |
| 93 | ``` | 93 | ``` |
| 94 | 94 | ||
| 95 | Currently, this parser is the only parser that allows an array of `Param` that | 95 | Currently, this parser is the only parser that allows an array of `Param` that is generated at runtime. |
| 96 | is generated at runtime. | ||
| 97 | 96 | ||
| 98 | ### `help` | 97 | ### `help` |
| 99 | 98 | ||
| 100 | The `help` prints a simple list of all parameters the program can take. It expects the | 99 | `help` prints a simple list of all parameters the program can take. It expects the `Id` to have a |
| 101 | `Id` to have a `description` method and an `value` method so that it can provide that | 100 | `description` method and an `value` method so that it can provide that in the output. `HelpOptions` |
| 102 | in the output. `HelpOptions` is passed to `help` to control how the help message is | 101 | is passed to `help` to control how the help message is printed. |
| 103 | printed. | ||
| 104 | 102 | ||
| 105 | ```zig | 103 | ```zig |
| 106 | {s} | 104 | {s} |
| @@ -117,8 +115,8 @@ $ zig-out/bin/help --help | |||
| 117 | 115 | ||
| 118 | ### `usage` | 116 | ### `usage` |
| 119 | 117 | ||
| 120 | The `usage` prints a small abbreviated version of the help message. It expects the `Id` | 118 | `usage` prints a small abbreviated version of the help message. It expects the `Id` to have a |
| 121 | to have a `value` method so it can provide that in the output. | 119 | `value` method so it can provide that in the output. |
| 122 | 120 | ||
| 123 | ```zig | 121 | ```zig |
| 124 | {s} | 122 | {s} |