| 1 | # clap-cargo |
| 2 | |
| 3 | > Re-usable CLI flags for `cargo` plugins |
| 4 | |
| 5 | [](https://codecov.io/gh/crate-ci/clap-cargo) |
| 6 | [][Documentation] |
| 7 |  |
| 8 | [][Crates.io] |
| 9 | |
| 10 | ## Examples |
| 11 | |
| 12 | ```rust |
| 13 | // ... |
| 14 | #[derive(Debug, clap::Parser)] |
| 15 | #[command(styles = clap_cargo::style::CLAP_STYLING)] |
| 16 | struct Cli { |
| 17 | #[command(flatten)] |
| 18 | manifest: clap_cargo::Manifest, |
| 19 | #[command(flatten)] |
| 20 | workspace: clap_cargo::Workspace, |
| 21 | #[command(flatten)] |
| 22 | features: clap_cargo::Features, |
| 23 | } |
| 24 | ``` |
| 25 | |
| 26 | ## Relevant crates |
| 27 | |
| 28 | Other crates that might be useful for cargo plugins: |
| 29 | * [escargot][escargot] for wrapping `cargo-build`, `carg-run`, `cargo-test`, etc. |
| 30 | * [cargo_metadata][cargo_metadata] for getting crate information. |
| 31 | * [clap-verbosity][clap-verbosity] for adding logging to your CLI. |
| 32 | |
| 33 | [escargot]: https://crates.io/crates/escargot |
| 34 | [cargo_metadata]: https://crates.io/crates/cargo_metadata |
| 35 | [clap-verbosity]: https://crates.io/crates/clap-verbosity-flag |
| 36 | |
| 37 | ## License |
| 38 | |
| 39 | Licensed under either of |
| 40 | |
| 41 | * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>) |
| 42 | * MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/license/mit>) |
| 43 | |
| 44 | at your option. |
| 45 | |
| 46 | ### Contribution |
| 47 | |
| 48 | Unless you explicitly state otherwise, any contribution intentionally |
| 49 | submitted for inclusion in the work by you, as defined in the Apache-2.0 |
| 50 | license, shall be dual-licensed as above, without any additional terms or |
| 51 | conditions. |
| 52 | |
| 53 | [Crates.io]: https://crates.io/crates/clap-cargo |
| 54 | [Documentation]: https://docs.rs/clap-cargo |