diff --git a/src/config.rs b/src/config.rs index deafae4f..52e733e6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -377,6 +377,12 @@ pub struct Composer { self_update: Option, } +#[derive(Deserialize, Default, Debug, Merge)] +#[serde(deny_unknown_fields)] +pub struct Elan { + self_update: Option, +} + #[derive(Deserialize, Default, Debug, Merge)] #[serde(deny_unknown_fields)] pub struct Vim { @@ -509,6 +515,9 @@ pub struct ConfigFile { #[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)] deno: Option, + #[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)] + elan: Option, + #[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)] vim: Option, @@ -1245,6 +1254,15 @@ impl Config { .unwrap_or(false) } + /// Whether Elan should update itself + pub fn elan_self_update(&self) -> bool { + self.config_file + .elan + .as_ref() + .and_then(|c| c.self_update) + .unwrap_or(true) + } + /// Whether to force plug update in Vim pub fn force_vim_plug_update(&self) -> bool { self.config_file diff --git a/src/steps/generic.rs b/src/steps/generic.rs index 1d125583..abd7dba7 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -258,10 +258,12 @@ pub fn run_elan(ctx: &ExecutionContext) -> Result<()> { let elan = require("elan")?; print_separator("elan"); - ctx.run_type() - .execute(&elan) - .args(["self", "update"]) - .status_checked()?; + if ctx.config().elan_self_update() { + ctx.run_type() + .execute(&elan) + .args(["self", "update"]) + .status_checked()?; + } ctx.run_type().execute(&elan).arg("update").status_checked() }