]> git.proxmox.com Git - rustc.git/blob - vendor/clap-4.2.1/examples/cargo-example.md
New upstream version 1.71.1+dfsg1
[rustc.git] / vendor / clap-4.2.1 / examples / cargo-example.md
1 For more on creating a custom subcommand, see [the cargo
2 book](https://doc.rust-lang.org/cargo/reference/external-tools.html#custom-subcommands).
3 The crate [`clap-cargo`](https://github.com/crate-ci/clap-cargo) can help in
4 mimicking cargo's interface.
5
6 The help looks like:
7 ```console
8 $ cargo-example --help
9 Usage: cargo <COMMAND>
10
11 Commands:
12 example A simple to use, efficient, and full-featured Command Line Argument Parser
13 help Print this message or the help of the given subcommand(s)
14
15 Options:
16 -h, --help Print help
17
18 $ cargo-example example --help
19 A simple to use, efficient, and full-featured Command Line Argument Parser
20
21 Usage: cargo example [OPTIONS]
22
23 Options:
24 --manifest-path <PATH>
25 -h, --help Print help
26 -V, --version Print version
27
28 ```
29
30 Then to directly invoke the command, run:
31 ```console
32 $ cargo-example example
33 None
34
35 $ cargo-example example --manifest-path Cargo.toml
36 Some("Cargo.toml")
37
38 ```