From f5c2368a4d9ad719ef3d119b72f172c4b802feb2 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Mon, 19 Aug 2019 20:15:01 +0300 Subject: [PATCH] Add flags to disable rust and cargo (fix #200) --- src/config.rs | 6 ++++++ src/main.rs | 29 +++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/config.rs b/src/config.rs index 562b5413..d26212f4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -24,6 +24,8 @@ lazy_static! { m.insert("gem", Step::Gem); m.insert("sdkman", Step::Sdkman); m.insert("remotes", Step::Remotes); + m.insert("rustup", Step::Rustup); + m.insert("cargo", Step::Cargo); #[cfg(windows)] m.insert("powershell", Step::Powershell); @@ -49,6 +51,10 @@ pub enum Step { Sdkman, /// Don't run remote Togprades Remotes, + /// Don't run Rustup + Rustup, + /// Don't run Cargo + Cargo, /// Don't update Powershell modules Powershell, } diff --git a/src/main.rs b/src/main.rs index baffb23b..e0e182be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -278,18 +278,23 @@ fn run() -> Result<(), Error> { )?; } - execute( - &mut report, - "rustup", - || generic::run_rustup(&base_dirs, run_type), - config.no_retry(), - )?; - execute( - &mut report, - "cargo", - || generic::run_cargo_update(run_type), - config.no_retry(), - )?; + if config.should_run(Step::Rustup) { + execute( + &mut report, + "rustup", + || generic::run_rustup(&base_dirs, run_type), + config.no_retry(), + )?; + } + + if config.should_run(Step::Cargo) { + execute( + &mut report, + "cargo", + || generic::run_cargo_update(run_type), + config.no_retry(), + )?; + } if config.should_run(Step::Emacs) { execute(&mut report, "Emacs", || emacs.upgrade(run_type), config.no_retry())?;