Disable winget by default
This commit is contained in:
@@ -160,6 +160,7 @@ pub struct Windows {
|
|||||||
accept_all_updates: Option<bool>,
|
accept_all_updates: Option<bool>,
|
||||||
self_rename: Option<bool>,
|
self_rename: Option<bool>,
|
||||||
open_remotes_in_new_terminal: Option<bool>,
|
open_remotes_in_new_terminal: Option<bool>,
|
||||||
|
enable_winget: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Default, Debug)]
|
#[derive(Deserialize, Default, Debug)]
|
||||||
@@ -859,4 +860,13 @@ impl Config {
|
|||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn enable_winget(&self) -> bool {
|
||||||
|
return self
|
||||||
|
.config_file
|
||||||
|
.windows
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|w| w.enable_winget)
|
||||||
|
.unwrap_or(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use log::debug;
|
|||||||
|
|
||||||
use crate::execution_context::ExecutionContext;
|
use crate::execution_context::ExecutionContext;
|
||||||
use crate::executor::{CommandExt, RunType};
|
use crate::executor::{CommandExt, RunType};
|
||||||
use crate::terminal::print_separator;
|
use crate::terminal::{print_separator, print_warning};
|
||||||
use crate::utils::require;
|
use crate::utils::require;
|
||||||
use crate::{error::SkipStep, steps::git::Repositories};
|
use crate::{error::SkipStep, steps::git::Repositories};
|
||||||
use crate::{powershell, Step};
|
use crate::{powershell, Step};
|
||||||
@@ -42,6 +42,11 @@ pub fn run_winget(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
|
|
||||||
print_separator("winget");
|
print_separator("winget");
|
||||||
|
|
||||||
|
if !ctx.config().enable_winget() {
|
||||||
|
print_warning("Winget is disabled by default. Enable it by setting enable_winget=true in the [windows] section in the configuration.");
|
||||||
|
return Err(SkipStep(String::from("Winget is disabled by default")).into());
|
||||||
|
}
|
||||||
|
|
||||||
ctx.run_type().execute(&winget).args(&["upgrade", "--all"]).check_run()
|
ctx.run_type().execute(&winget).args(&["upgrade", "--all"]).check_run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user