summaryrefslogtreecommitdiff
path: root/example/README.md.template
diff options
context:
space:
mode:
authorGravatar Jimmi Holst Christensen2024-10-24 17:40:56 +0200
committerGravatar Jimmi Holst Christensen2024-10-24 17:40:56 +0200
commit9de3cd86063d9476be0b7690d69c20f315d271b0 (patch)
tree0faafb2b82ddd85ddc824332310be23660c5867c /example/README.md.template
parentfeat: Support multiple positionals of different types (diff)
downloadzig-clap-subcommand-example.tar.gz
zig-clap-subcommand-example.tar.xz
zig-clap-subcommand-example.zip
docs: Add subcommand examplesubcommand-example
Diffstat (limited to 'example/README.md.template')
-rw-r--r--example/README.md.template11
1 files changed, 10 insertions, 1 deletions
diff --git a/example/README.md.template b/example/README.md.template
index d234dcd..bcd3774 100644
--- a/example/README.md.template
+++ b/example/README.md.template
@@ -63,7 +63,7 @@ The result will contain an `args` field and a `positionals` field. `args` will h
63for each none positional parameter of your program. The name of the field will be the longest 63for each none positional parameter of your program. The name of the field will be the longest
64name of the parameter. `positionals` be a tuple with one field for each positional parameter. 64name of the parameter. `positionals` be a tuple with one field for each positional parameter.
65 65
66The fields in `args` and `psotionals` are typed. The type is based on the name of the value the 66The fields in `args` and `postionals` are typed. The type is based on the name of the value the
67parameter takes. Since `--number` takes a `usize` the field `res.args.number` has the type `usize`. 67parameter takes. Since `--number` takes a `usize` the field `res.args.number` has the type `usize`.
68 68
69Note that this is only the case because `clap.parsers.default` has a field called `usize` which 69Note that this is only the case because `clap.parsers.default` has a field called `usize` which
@@ -74,6 +74,15 @@ contains a parser that returns `usize`. You can pass in something other than
74{s} 74{s}
75``` 75```
76 76
77### Subcommands
78
79There is an option for `clap.parse` and `clap.parseEx` called `terminating_positional`. It allows
80for users of `clap` to implement subcommands in their cli application:
81
82```zig
83{s}
84```
85
77### `streaming.Clap` 86### `streaming.Clap`
78 87
79The `streaming.Clap` is the base of all the other parsers. It's a streaming parser that uses an 88The `streaming.Clap` is the base of all the other parsers. It's a streaming parser that uses an