Skip to content

Commit

Permalink
fix(cli): align rustup show's --verbose behavior with `rustup sho…
Browse files Browse the repository at this point in the history
…w active-toolchain`
  • Loading branch information
rami3l committed Dec 30, 2024
1 parent 1fe9366 commit ae210ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,11 @@ fn show(cfg: &Cfg<'_>, verbose: bool) -> Result<utils::ExitCode> {
&active_reason,
)?;
writeln!(t.lock(), "name: {}", active_toolchain.name())?;
writeln!(t.lock(), "compiler: {}", active_toolchain.rustc_version())?;
writeln!(t.lock(), "active because: {}", active_reason)?;
if verbose {
writeln!(t.lock(), "compiler: {}", active_toolchain.rustc_version())?;
writeln!(t.lock(), "path: {}", active_toolchain.path().display())?;
}

// show installed targets for the active toolchain
writeln!(t.lock(), "installed targets:")?;
Expand Down
15 changes: 8 additions & 7 deletions tests/suite/cli_rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,6 @@ nightly-{0} (active, default)
active toolchain
----------------
name: nightly-{0}
compiler: 1.3.0 (hash-nightly-2)
active because: it's the default toolchain
installed targets:
{0}
Expand Down Expand Up @@ -735,7 +734,6 @@ nightly-{0} (active, default)
active toolchain
----------------
name: nightly-{0}
compiler: 1.3.0 (hash-nightly-2)
active because: it's the default toolchain
installed targets:
{0}
Expand Down Expand Up @@ -774,7 +772,6 @@ nightly-{0} (active, default)
active toolchain
----------------
name: nightly-{0}
compiler: 1.3.0 (xxxx-nightly-2)
active because: it's the default toolchain
installed targets:
{1}
Expand Down Expand Up @@ -831,7 +828,6 @@ nightly-{0} (active, default)
active toolchain
----------------
name: nightly-{0}
compiler: 1.3.0 (xxxx-nightly-2)
active because: it's the default toolchain
installed targets:
{1}
Expand Down Expand Up @@ -1139,7 +1135,6 @@ nightly-{0} (active, default)
active toolchain
----------------
name: nightly-{0}
compiler: 1.3.0 (hash-nightly-2)
active because: overridden by environment variable RUSTUP_TOOLCHAIN
installed targets:
{0}
Expand Down Expand Up @@ -1227,11 +1222,17 @@ nightly-2015-01-01-{0}
active toolchain
----------------
name: nightly-{0}
compiler: 1.3.0 (hash-nightly-2)
active because: it's the default toolchain
compiler: 1.3.0 (hash-nightly-2)
path: {2}
installed targets:
{0}
"
",
config
.rustupdir
.join("toolchains")
.join(for_host!("nightly-{0}"))
.display()
),
r"",
)
Expand Down

0 comments on commit ae210ce

Please sign in to comment.