有没有办法控制货物的输出文件名? cargo rustc -- -o filename
给出文件名哈希:
$ mkdir output-filename
$ cd output-filename/
$ cargo init
Created binary (application) package
$ cargo rustc -v --release -- -o filename
Compiling output-filename v0.1.0 (/private/tmp/output-filename)
Running `rustc --edition=2018 --crate-name output_filename src/main.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 -o filename -C metadata=c961d75f8bcf3c48 -C extra-filename=-c961d75f8bcf3c48 --out-dir /private/tmp/output-filename/target/release/deps -L dependency=/private/tmp/output-filename/target/release/deps`
warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type
warning: ignoring --out-dir flag due to -o flag
warning: ignoring -C extra-filename flag due to -o flag
Finished release [optimized] target(s) in 0.39s
$ ls
Cargo.lock filename-c961d75f8bcf3c48 src
Cargo.toml filename-c961d75f8bcf3c48.d target
输出甚至建议忽略-C extra-filename=-c961d75f8bcf3c48
,但事实并非如此。我可以编写脚本,例如
mv $(ls filename* | grep -E 'filename-\w+$') filename
但是我宁愿了解如何控制货物/锈蚀。