• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1For more on creating a custom subcommand, see [the cargo
2book](https://doc.rust-lang.org/cargo/reference/external-tools.html#custom-subcommands).
3The crate [`clap-cargo`](https://github.com/crate-ci/clap-cargo) can help in
4mimicking cargo's interface.
5
6The help looks like:
7```console
8$ cargo-example-derive --help
9Usage: cargo <COMMAND>
10
11Commands:
12  example-derive  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
15Options:
16  -h, --help  Print help
17
18$ cargo-example-derive example-derive --help
19A simple to use, efficient, and full-featured Command Line Argument Parser
20
21Usage: cargo example-derive [OPTIONS]
22
23Options:
24      --manifest-path <MANIFEST_PATH>
25  -h, --help                           Print help
26  -V, --version                        Print version
27
28```
29
30Then to directly invoke the command, run:
31```console
32$ cargo-example-derive example-derive
33None
34
35$ cargo-example-derive example-derive --manifest-path Cargo.toml
36Some("Cargo.toml")
37
38```
39