[英]How can I specify which crate `cargo run` runs by default in the root of a Cargo workspace?
[英]Pass default arguments to cargo run
我有以下二进制 crate 源结构:
prj
|
|__config
| |___conf.toml
|
|___src
| |_...
|
|__Cargo.toml
因此,在执行cargo run
时,我希望以下命令运行bin /path/to/prj/config/conf.toml
。
是否可以在Cargo.toml
中配置cargo run
,以便将绝对路径传递给config/conf.toml
而无需每次都明确传递?
是否可以在
Cargo.toml
中config cargo
运行,以便将绝对路径传递给config/conf.toml
而无需每次都明确传递?
不完全是,但 Cargo可以在其配置文件中使用命令别名进行配置。 例如,您可以将以下内容放入${PROJECT_ROOT}/.cargo/config.toml
:
[alias]
runx = "run /path/to/config/conf.toml"
然后你就做cargo runx
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.