Uh oh!
There was an error while loading. Please reload this page.
Make rustup show output info in a more logical order - #3225
Conversation
rbtcollins
commented
Feb 19, 2023
My gut reaction is that folk usually want the active toolchain information, so having it first or last is best; and last means they don't need to scan far for it or use head. Neither first nor last will match your concept though. Thanks for demonstrating the idea clearly though! |
majaha
commented
Feb 20, 2023
Thanks for considering it! I've fixed the tests I broke, amended the commit and commit message and force pushed. Apologies to anyone who pulled the original commit. |
majaha
commented
Feb 20, 2023
There's always Matt@Matts-PC /c/d/p/r/rustup (show-order)> rustup show active-toolchain
stable-x86_64-pc-windows-msvc (default)
Matt@Matts-PC /c/d/p/r/rustup (show-order)> rustup show active-toolchain -v
stable-x86_64-pc-windows-msvc (default)
rustc 1.67.1 (d5a82bbd2 2023-02-07) |
rustup show output info in a more logical ordermajaha
commented
Feb 20, 2023
As an aside, would it be possible to reformat the reason the active toolchain was chosen? At the moment the floating -> Also, there's some scope for code deduplication between |
workingjubilee
commented
Mar 11, 2023
I feel like "\nReason:" is nondescript (reason for what? it's dissociated from the phrase "active toolchain" by multiple lines by that point) and the " (inline comment)" style is better, but I don't think " (default)" is a good explanation either. |
majaha
commented
Mar 12, 2023
It's a little terse, I'll admit. I think because it's right next to the other parts of the active toolchain, you can work out what it's the reason for using context from the reason message. But I would be open to: Either way, it's certainly more descriptive than the other lines! Perhaps it should really be: |
workingjubilee
commented
May 9, 2023
Hm. Why not reframe it and instead |
rbtcollins
commented
May 28, 2023
What would happen if we put the reason on the same line as Active toolchain.
(or something similar). Having thought more about this I do like the idea of making targets subordinate to the toolchain. Perhaps like this: |
majaha
commented
May 28, 2023
Yes, that's definitely an improvement! Although I think we could do away with the blank lines after the |
@majaha would you be able to rebase this and follow up on the discussion so far? |
majaha
commented
Oct 26, 2023
Okay, I've rebased the old patch. We're probably not ready to merge yet though, as we were still discussing and iterating on what we wanted to do. I'm going to have another think about what we want here. |
majaha
commented
Oct 26, 2023
Okay, I've spent some more time thinking about the output format, incorporating some other's ideas, and this is what I've come up with: I thought about putting the active reason in the header like this: but decided against it as the We should also change the format of ⬇ |
Indeed, breaking that into two lines might be a good idea. @majaha, it looks like we are moving in the right direction!
I still prefer using However, I'd like to add an ... and we might want to use |
@rbtcollins@djc Instead of changing to <snip>
active toolchain
----------------
name: stable-x86_64-pc-windows-msvc
compiler: rustc 1.73.0 (cc66ad468 2023-10-03)
active because: overridden by +toolchain on the command line
targets:
wasm32-unknown-unknown
x86_64-pc-windows-msvcOther than this I have no outstanding concerns at the moment. |
majaha
commented
Nov 4, 2023
Sorry, do you mean that you want it to be on the same line as the header next to |
A separate line underneath, just like in my snippets above. |
majaha
commented
Nov 4, 2023
Ah, gotcha. Yeah, I think you're version looks quite clean! |
djc
commented
Nov 20, 2023
This looks good to me. So can we get the code updated to match the proposed style? |
majaha
commented
Nov 21, 2023
Okay, I'm working on this. Here's a thought I had: Should we always have the |
@majaha As a quick reminder, with the currently proposed style, the output should be like: $ RUSTUP_TOOLCHAIN=nightly rustup show active-toolchainnightly-x86_64-pc-windows-msvcactive because: environment override by RUSTUP_TOOLCHAIN(From #3225 (comment)) ... with $ rustup showDefault host: x86_64-pc-windows-msvcrustup home: C:\Users\Matt\.rustupinstalled toolchains--------------------stable-x86_64-pc-windows-msvc (active)nightly-x86_64-pc-windows-msvc (default)active toolchain----------------name: stable-x86_64-pc-windows-msvccompiler: rustc 1.73.0 (cc66ad468 2023-10-03)active because: overridden by +toolchain on the command linetargets: wasm32-unknown-unknown x86_64-pc-windows-msvc(From #3225 (comment)) Also, (From #3225 (comment)) |
I've uploaded the new patch, which includes the changes and a bit of a refactoring:
|
djc
commented
Dec 7, 2023
@majaha this sounds great, except I'd like to request basically one commit per bullet point, which should make it a lot easier to review this. Do you think that would be feasible? |
This changes the format of `rustup show` to be in a more logical order, and changes the format of `rustup show active-toolchain` to match. Also, as suggested in a comment, these commands will no longer install the active toolchain if it is not already installed, as they now call `cfg.find_active_toolchain()` instead of `cfg.find_or_install_active_toolchain()`. This fixesrust-lang#1397
Update the format of `rustup toolchain list` to have a similar flavour to the new `rustup show` format.
`rustup default` will no longer error and print to stderr if there is no default toolchain configured. It will print to stdout and exit successfully instead.
Fix an issue where the documentation erroneously states that `rust-toolchain.toml` config files can't specify custom toolchain names. This language seems to be very old, ultimately inherited from the original commit that added this feature, and is no longer true: rust-lang@107d8e5#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R330
majaha
commented
May 8, 2024
Nice, well done on merging this guys! |
rust-lang/rustup#3225 changed `rustup toolchain list --verbose` to use spaces instead of tabs as a delimiter. anza-xyz/agave#6981 changed `cargo-build-sbf` to split `rustup toolchain list --verbose` only on spaces, not all whitespace. This made it incompatible with rustup < 1.28.0. Reintroduce compatibility by splitting on all ASCII whitespace. Fixesanza-xyz#48.
* Fix compatibility with rustup < 1.28.0 rust-lang/rustup#3225 changed `rustup toolchain list --verbose` to use spaces instead of tabs as a delimiter. anza-xyz/agave#6981 changed `cargo-build-sbf` to split `rustup toolchain list --verbose` only on spaces, not all whitespace. This made it incompatible with rustup < 1.28.0. Reintroduce compatibility by splitting on all ASCII whitespace. Fixes#48. * Don't collect substrings into a vector We're only interested in the first and last substring.
I ran
rustup showand noticed that its output is in the order:installed toolchains -> installed targets for active toolchain -> active toolchain
I thought it would make sense to put "active toolchain" before " installed targets for active toolchain" so that they in order of decreasing scope:
installed toolchains -> active toolchain -> installed targets for active toolchain
so that is what this patch does 🙂
Thoughts?
Before:
After:
Fixes#1397