Skip to content

A simple way to update all cargo installed binaries (potential cargo-install-update integration) #9527

Open
@eddyp

Description

@eddyp

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:

C:\>cargo install --list
cargo-add v0.2.0:
    cargo-add.exe
cargo-asm v0.1.16:
    cargo-asm.exe
    cargo-llvm-ir.exe
cargo-audit v0.11.2:
    cargo-audit.exe
cargo-binutils v0.1.6:
    cargo-nm.exe
    cargo-objcopy.exe
    cargo-objdump.exe
    cargo-profdata.exe
    cargo-readobj.exe
    cargo-size.exe
    cargo-strip.exe
cargo-bloat v0.9.3:
    cargo-bloat.exe
cargo-deny v0.6.6:
    cargo-deny.exe
....

And the way I was thinking it would have worked was something like this (NOT AN ACTUAL LISTING):

C:\>cargo install --update-all
cargo-add v0.2.0: up to date
cargo-asm v0.1.16: up to date
cargo-audit v0.11.2: outdated, installing v0.14.1
cargo-binutils v0.1.6: outdated, instaling v0.3.3
cargo-bloat v0.9.3: outdated, installing v0.10.0
cargo-deny v0.6.6: outdated, installing v0.9.1
...

The --update-all option can have a pretend/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, as cargo 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-installE-mediumExperience: MediumS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions