Skip to content

Commit 8b20701

Browse files
committed
feat(rustup-mode): add no_update flag to rustup toolchain install
1 parent 591ed27 commit 8b20701

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

src/cli/rustup_mode.rs

Lines changed: 10 additions & 2 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,
@@ -966,8 +970,12 @@ async fn update(
966970
let profile = cfg.get_profile()?;
967971
let status = match DistributableToolchain::new(cfg, desc.clone()) {
968972
Ok(mut d) => {
969-
d.update_extra(&components, &targets, profile, force, allow_downgrade)
970-
.await?
973+
if !opts.no_update {
974+
d.update_extra(&components, &targets, profile, force, allow_downgrade)
975+
.await?
976+
} else {
977+
UpdateStatus::Unchanged
978+
}
971979
}
972980
Err(RustupError::ToolchainNotInstalled { .. }) => {
973981
DistributableToolchain::install(

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)