cargo read-manifest
将打印包含
targets
您可以使用的密钥。使用
jq
为了过滤和漂亮打印,下面是
rustfmt
机箱:
â cargo read-manifest | jq '.targets'
[
{
"kind": [
"lib"
],
"name": "rustfmt",
"src_path": "/Users/.../rustfmt/src/lib.rs"
},
{
"kind": [
"bin"
],
"name": "cargo-fmt",
"src_path": "/Users/.../rustfmt/src/bin/cargo-fmt.rs"
},
{
"kind": [
"bin"
],
"name": "rustfmt",
"src_path": "/Users/.../rustfmt/src/bin/rustfmt.rs"
},
{
"kind": [
"custom-build"
],
"name": "build-script-build",
"src_path": "build.rs"
},
{
"kind": [
"test"
],
"name": "system",
"src_path": "/Users/.../rustfmt/tests/system.rs"
}
]