-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A simple way to update all cargo install
ed binaries (potential cargo-install-update
integration)
#9527
Comments
There exists a |
For the SemVer compatibility cargo/crates.io repecting to, The Cargo Book gets a nice chapter, and it seems that under
|
Looking at the crate page look like the functionality is the desired one: C:\>cargo install-update -l
Updating registry 'https://github.com/rust-lang/crates.io-index'
Package Installed Latest Needs update
cargo-audit v0.11.2 v0.14.1 Yes
cargo-binutils v0.1.6 v0.3.3 Yes
cargo-inspect v0.7.0 v0.10.3 Yes
cargo-llvm-lines v0.4.6 v0.4.11 Yes
cargo-outdated v0.9.9 v0.9.15 Yes
cargo-pants v0.1.1 v0.1.25 Yes
...
cargo-deps v1.4.1 v1.4.1 No
cargo-update v7.0.1 v7.0.1 No
ripgrep v12.1.1 v12.1.1 No With its
and it seems C:\>cargo install-update --all
Updating registry 'https://github.com/rust-lang/crates.io-index'
Package Installed Latest Needs update
cargo-audit v0.11.2 v0.14.1 Yes
cargo-binutils v0.1.6 v0.3.3 Yes
cargo-inspect v0.7.0 v0.10.3 Yes
cargo-llvm-lines v0.4.6 v0.4.11 Yes
cargo-outdated v0.9.9 v0.9.15 Yes
cargo-pants v0.1.1 v0.1.25 Yes
cargo-udeps v0.1.1 v0.1.21 Yes
git-absorb v0.6.0 v0.6.6 Yes
git-bonsai v0.1.0 v0.2.1 Yes
git-trim v0.3.2 v0.4.2 Yes
hexyl v0.5.1 v0.8.0 Yes
sd v0.6.5 v0.7.6 Yes
svd2rust v0.17.0 v0.19.0 Yes
tokei v10.0.1 v12.1.2 Yes
topgrade v5.8.1 v6.9.1 Yes
xargo v0.3.22 v0.3.23 Yes
cargo-add v0.2.0 v0.2.0 No
cargo-asm v0.1.16 v0.1.16 No
cargo-bloat v0.10.0 v0.10.0 No
cargo-deny v0.9.1 v0.9.1 No
cargo-deps v1.4.1 v1.4.1 No
cargo-update v7.0.1 v7.0.1 No
ripgrep v12.1.1 v12.1.1 No
Updating cargo-audit
Downloaded cargo-audit v0.14.1
Downloaded 1 crate (157.5 KB) in 1.16s
Updating crates.io index
Installing cargo-audit v0.14.1
Downloaded addr2line v0.15.2
Downloaded once_cell v1.7.2
Downloaded stable_deref_trait v1.2.0
Downloaded generational-arena v0.2.8
Downloaded backtrace v0.3.60
Downloaded object v0.25.2
Downloaded tracing-core v0.1.18
Downloaded unicode-normalization v0.1.19
Downloaded zeroize v1.3.0
Downloaded regex-automata v0.1.10
....
Just as a matter of taste, I kind of dislike the command names and the fact it prints the details of the authors upfront in The only reservation I have is the dependency on Cmake which might be a turnoff for some people, so it might make sense to integrate into cargo and drop the dependency:
(Just as a coincidence I had Cmake installed on the system I tested, but I doubt I would have went through the trouble to install it if I didn't. It feels like this should be a native functionality of Cargo and I suspect much of the logic in cargo-update is already existing in cargo, including some corner cases, but that is just a hunch.) |
@weihanglo what about integrating https://lib.rs/cargo-update into |
I am not a member cargo team, so the followings are only my 2 cents. As Rust getting popular, the small cargo team cannot handle all these feature requests and bugs. They might not have extra time to take care more new commands. They need helps. If we do want to integrate cargo-update as a built-in command, there are things we can do:
Looking forward to making cargo more friendly together! |
This is a work-around which doesn't require cargo install $(cargo install --list | egrep '^[a-z0-9_-]+ v[0-9.]+:$' | cut -f1 -d' ') |
cargo install --update-all
as a simple way to update all locally installed tools with cargo install
cargo install
ed binaries (potential cargo-install-update
integration)
I'm afraid the Cargo CLI API may not be stable enough to guarantee the regex won't break. I understand it's just a workaround, so that should be expected |
If you use nushell simply use this script cargo install --list
| parse "{package} v{version}:"
| get package
| each {|p| cargo install $p} |
|
@TaQuanMinhLong some crates only work with the locked option, so it might me better to go with
|
Describe the problem you are trying to solve
As suggested in the second comment of #2082, it would be really useful to be able to easily upgrade all binary tools installed via
cargo install
in a system, now that #2082 was fixed for a single package (proposal in #6667 and implementation from #6798 stabilization via #7560).Describe the solution you'd like
We currently have
cargo install --list
list information about the tools, but cargo appears to be lacking a way to upgrade them en-masse like this:For instance, on a system I see there are some tools I have, but it's not clear if they are up to date:
And the way I was thinking it would have worked was something like this (NOT AN ACTUAL LISTING):
The
--update-all
option can have apretend
/dry-run
suboption that coud just list what would be done, or whatever that flag name might be named in other places in cargo (suggestions for flag name, shamelessly copied from apt:-s, --simulate, --just-print, --dry-run, --recon, --no-act
).It might be
cargo install --list
could be complemented by a flag that could list the cargo.io versions, too, but since that would hit the internet for info, that probably makes sense not to be default. Not sure what's best, ascargo onstall --list
feels like the proper place to see the info (including the 'is this up to date' info).Notes
Not sure what should happen WRT semantic versioning, but my gut feeling under-0 versions could be updated by default, but the 1.0+ versions might make sense to have the behavior follow SemVer and not upgrade, so not sure which is a sane default.
The text was updated successfully, but these errors were encountered: