Skip to content

Commit 0f42069

Browse files
committed
feat(rustup-mode): add no_update flag to rustup toolchain install
1 parent 323bf9f commit 0f42069

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

src/cli/rustup_mode.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ struct UpdateOpts {
386386
#[arg(long)]
387387
no_self_update: bool,
388388

389+
/// Don't try to update the installed toolchain
390+
#[arg(long)]
391+
no_update: bool,
392+
389393
/// Force an update, even if some components are missing
390394
#[arg(long)]
391395
force: bool,
@@ -971,9 +975,13 @@ async fn update(
971975

972976
let status = match DistributableToolchain::new(cfg, desc.clone()) {
973977
Ok(d) => {
974-
InstallMethod::Dist(dist_opts.for_update(&d, opts.allow_downgrade))
975-
.install()
976-
.await?
978+
if !opts.no_update {
979+
InstallMethod::Dist(dist_opts.for_update(&d, opts.allow_downgrade))
980+
.install()
981+
.await?
982+
} else {
983+
UpdateStatus::Unchanged
984+
}
977985
}
978986
Err(RustupError::ToolchainNotInstalled { .. }) => {
979987
DistributableToolchain::install(dist_opts).await?.0

tests/suite/cli_rustup_ui/rustup_toolchain_cmd_install_cmd_help_flag.stdout.term.svg

Lines changed: 20 additions & 18 deletions
Loading

0 commit comments

Comments
 (0)