cargo-bins / cargo-binstall

Binary installation for rust projects
GNU General Public License v3.0
1.6k stars 57 forks source link

Uninstall command? #400

Open spoorn opened 2 years ago

spoorn commented 2 years ago

Is there an uninstall command to uninstall binaries installed with cargo-binstall?

I tried deleting the symlink and binary from ~/.cargo/bin, but cargo-binstall says the package is still installed, yet I can no longer use it

Edit: I was able to fix this manually by deleting ~/.cargo/binstall, but there should be a better way

NobodyXu commented 2 years ago

No there isn't, it's probably a good idea to add one.

NobodyXu commented 2 years ago

To remove a binary, you also need to edit ~/.cargo/.crates.toml and ~/.cargo/binstall/crates-v1.json to remove the crate.

NobodyXu commented 2 years ago

This one might be related to #176 . @passcod Any idea how can we approach this?

IMO we might need to introduce another cargo subcommand for it like in #176, introducing a new flag --uninstall would just be confusing.

passcod commented 2 years ago

I agree. cargo buninstall?

NobodyXu commented 2 years ago

I agree. cargo buninstall?

Can't think of a better name, so this one LGTM.

ryankurte commented 2 years ago

cargo buninstall?

😂

y'all think the overhead of managing multiple binaries is worth it over cargo binstall --remove (and something like cargo binstall --from-manifest) ? i quite like being able to wget one tool and just have things work

NobodyXu commented 2 years ago

y'all think the overhead of managing multiple binaries is worth it over cargo binstall --remove (and something like cargo binstall --from-manifest) ?

I also don't like maintaining multiple binaries and create a multi-use binary, but I'm just not sure whether --remove is a good idea since it could be a bit confusing.

passcod commented 2 years ago

Something we could do is transition to a subcommand pattern, but with a twist: reserve a few names, completely coincidentally on purpose the same as the crate names that are already perma-reserved due to ambiguity, like install, uninstall, reinstall, update, tools, and if we see that name as the first "crate" argument, we treat it as a subcommand, otherwise we default to the install subcommand.

(Also if we see any of these perma-reserved names in the list, regardless of position, we should just error or warn/ignore.)

That would let us have subcommands and transition the canonical usage to:

cargo binstall install tool1 tool2
cargo binstall uninstall tool3
cargo binstall tools

while also transparently supporting the current syntax of

cargo binstall tool4

as an alias to

cargo binstall install tool4
LikeLakers2 commented 1 year ago

Hi, I actually have a different suggestion than having a whole new uninstall command added to cargo-binstall. Why not have cargo uninstall do the work for us?

For example, with cargo-edit, cargo-binstall currently inserts the following entry:

v1 = {
    "cargo-edit 0.11.8 (registry+https://github.com/rust-lang/crates.io-index)" = [
        "cargo-add", "cargo-rm", "cargo-set-version", "cargo-upgrade"
    ]
}

If we edit the entry to include the symlink targets:

v1 = {
    "cargo-edit 0.11.8 (registry+https://github.com/rust-lang/crates.io-index)" = [
        "cargo-add", "cargo-add-v0.11.8",
        "cargo-rm", "cargo-rm-v0.11.8",
        "cargo-set-version", "cargo-set-version-v0.11.8",
        "cargo-upgrade", "cargo-upgrade-v0.11.8"
    ]
}

Then Cargo will trust that these are all part of cargo-edit, and delete them upon cargo uninstall cargo-edit:

C:\>cargo uninstall cargo-edit
    Removing C:\Users\me\.cargo\bin\cargo-add-v0.11.8.exe
    Removing C:\Users\me\.cargo\bin\cargo-add.exe
    Removing C:\Users\me\.cargo\bin\cargo-rm-v0.11.8.exe
    Removing C:\Users\me\.cargo\bin\cargo-rm.exe
    Removing C:\Users\me\.cargo\bin\cargo-set-version-v0.11.8.exe
    Removing C:\Users\me\.cargo\bin\cargo-set-version.exe
    Removing C:\Users\me\.cargo\bin\cargo-upgrade-v0.11.8.exe
    Removing C:\Users\me\.cargo\bin\cargo-upgrade.exe

To be clear, we could still have an uninstall subcommand of cargo-binstall -- but I don't currently see any reason for it to do much more than alias to cargo uninstall.

NobodyXu commented 1 year ago

@spoorn cargo-binstall now defaults to --no-symlink, and supports uninstalling via cargo-uninstall

@LikeLakers2 That's a good idea, I would do that when I have time since supporting --symlink isn't my priority now and I would accept PRs for this.

5310 commented 1 year ago

On systems without a proper Cargo install (containers and such), we can't rely on cargo-uninstall. I would still like to request a separate cargo-buninstall, or an option on cargo-binstall itself :pray:

NobodyXu commented 1 year ago

On systems without a proper Cargo install (containers and such), we can't rely on cargo-uninstall. I would still like to request a separate cargo-bnuninstall, or an option on cargo-binstall itself 🙏

Thanks, we can definitely add this (probably via multi-call).

satvikpendem commented 5 months ago

Is there an uninstall command now implemented? I didn't see anything on the --help

NobodyXu commented 5 months ago

Using cargo uninstall from cargo would work, our installation is compatible with cargo