Cargo 命令打印目标文件列表?
Cargo command to print the list of target files?
让 cargo
打印它将在 运行 cargo build
之后输出的文件列表的命令是什么?
cargo read-manifest
will print a JSON object that contains a targets
key that you can use. Using 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"
}
]
让 cargo
打印它将在 运行 cargo build
之后输出的文件列表的命令是什么?
cargo read-manifest
will print a JSON object that contains a targets
key that you can use. Using 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"
}
]