Here is my code in src/bin/foo.rs
:
use clap::command;
pub fn main() {
let matches = command!("foo")
.about("Simple util")
.get_matches();
}
I'm getting:
error: `cargo` feature flag is required
--> src/bin/foo.rs:30:19
|
30 | let matches = command!("foo")
| ^^^^^^^^^^^^^^^
|
In your Cargo.toml
file change your clap dependency to enable the cargo
feature.
eg
clap = { version = "3.2.20", features = ["cargo"] }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.