Skip to content
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

Add a "single column" mode for rustup toolchain list and friends #3519

Closed
tgross35 opened this issue Oct 29, 2023 · 6 comments · Fixed by #3862
Closed

Add a "single column" mode for rustup toolchain list and friends #3519

tgross35 opened this issue Oct 29, 2023 · 6 comments · Fixed by #3862
Assignees
Milestone

Comments

@tgross35
Copy link

Problem you are trying to solve

I update nightly frequently and always wind up with a lot of toolchains that I am unlikely to use again:

$ rustup show
installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-2023-04-29-x86_64-unknown-linux-gnu
nightly-2023-06-15-x86_64-unknown-linux-gnu
nightly-2023-06-19-x86_64-unknown-linux-gnu
nightly-2023-07-14-x86_64-unknown-linux-gnu
nightly-2023-07-22-x86_64-unknown-linux-gnu
nightly-2023-07-28-x86_64-unknown-linux-gnu
nightly-2023-08-08-x86_64-unknown-linux-gnu
nightly-2023-08-24-x86_64-unknown-linux-gnu
1.60-x86_64-unknown-linux-gnu
1.63-x86_64-unknown-linux-gnu
stage1
stage2
1.68.2-x86_64-unknown-linux-gnu
1.71.0-x86_64-unknown-linux-gnu
1.71.1-x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.75.0-nightly (e5cfc5547 2023-10-28)

There is no easy way to remove all toolchains matching a pattern

Solution you'd like

Allow * as a wildcard for removal and other relevant commands so that this works:

$ rustup toolchain remove nightly-2023-*
info: no toolchain installed for 'nightly-2023-*'

Notes

rustup 1.26.0 (5af9b94 2023-04-05)

@rami3l
Copy link
Member

rami3l commented Oct 30, 2023

@tgross35 Thanks a lot for filing this issue!

This is also one of the pain points that I often encounter when using rustup and elan, so I'm quite willing to address it. However, due to how rustup resolves toolchain names 1, this might not be a simple fix.

Furthermore, one might argue that a one-line script like the following will suffice:

rustup toolchain list | cut -d ' ' -f1 | grep nightly-2023- | xargs rustup uninstall

@rbtcollins @djc What do you think?

Footnotes

  1. In case you don't know, you can do something like rustup toolchain uninstall 1.39-x86_64.

@rbtcollins
Copy link
Contributor

the (default) in rustup toolchain list makes that harder to work with.

I wonder if dropping that default, making the list more API-like, adding 'rustup toolchain default' or something similar, would make this nicer.

I'm a bit skeptical of rustup doing its own globbing here.

@rami3l
Copy link
Member

rami3l commented Oct 30, 2023

@rbtcollins Okay, I think it would be better to find a workaround then.

IMHO it would be nice if we can leave the output as-is and add a new flag specifically to give simple outputs for non-interactive uses.
For instance, this is what we'll get if we borrow the "single-column mode" (written as -1) from brew:

> rustup toolchain list
stable-aarch64-apple-darwin (default)
nightly-aarch64-apple-darwin

> rustup toolchain list -1
stable-aarch64-apple-darwin
nightly-aarch64-apple-darwin

I don't quite like -1 though, and would possibly call it --simple/-s.
Or we can add a new --quiet for this purpose.

Anyway, this change should probably be mirrored to rustup target list and other similar commands.

@djc
Copy link
Contributor

djc commented Oct 30, 2023

I like -q/--quiet for this!

@rami3l
Copy link
Member

rami3l commented Nov 1, 2023

I'll find some time to implement this --quiet thing then. Claim.

@rami3l rami3l self-assigned this Nov 1, 2023
@rami3l
Copy link
Member

rami3l commented Nov 5, 2023

Now that the output format is being changed in #3225, I think we should wait a bit before implementing this.

@rami3l rami3l added this to the 1.28.0 milestone Jan 17, 2024
@rami3l rami3l changed the title Allow wildcards (*) when matching toolchains Add a "single column" mode for rustup toolchain list and friends Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants