[英]How can I find the latest stable version of a crate using cargo?
I want to know the latest actix-web version, so I executed cargo search actix-web
.我想知道最新的 actix-web 版本,所以我执行了
cargo search actix-web
。 The result is actix-web = "4.0.0-beta.1"
, showing the beta version number.结果是
actix-web = "4.0.0-beta.1"
,显示 beta 版本号。
I want to know the latest stable version number;我想知道最新的稳定版本号; how do I get it?
我怎么得到它?
cargo show --json $1 | python -m json.tool | jq ".versions[].num"
Usually, I only care to know about the version number of a crate when I'm going to add the crate to my Cargo.toml.通常,当我将 crate 添加到我的 Cargo.toml 时,我只关心知道 crate 的版本号。 In those cases, I use two extra Cargo subcommands from the cargo-edit project :
在这些情况下,我使用来自cargo-edit 项目的两个额外的 Cargo 子命令:
cargo add
— adds the current stable version of a crate to Cargo.toml
. cargo add
— 将当前稳定版本的 crate 添加到Cargo.toml
中。 Options exist for allowing prerelease versions or marking it as a build / dev dependency.cargo upgrade
— updates the version of a crate already in Cargo.toml
. cargo upgrade
— 更新Cargo.toml
中已有的 crate 版本。 Similar to cargo update
, but also changes Cargo.toml
in addition to Cargo.lock
.cargo update
类似,但除了Cargo.lock
Cargo.toml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.