Support yes flags for Powershell
This commit is contained in:
@@ -223,7 +223,7 @@ fn run() -> Result<()> {
|
|||||||
|
|
||||||
if should_run_powershell {
|
if should_run_powershell {
|
||||||
runner.execute(Step::Powershell, "Powershell Modules Update", || {
|
runner.execute(Step::Powershell, "Powershell Modules Update", || {
|
||||||
powershell.update_modules(run_type)
|
powershell.update_modules(&ctx)
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use crate::execution_context::ExecutionContext;
|
use crate::execution_context::ExecutionContext;
|
||||||
use crate::executor::{CommandExt, RunType};
|
use crate::executor::CommandExt;
|
||||||
use crate::terminal::{is_dumb, print_separator};
|
use crate::terminal::{is_dumb, print_separator};
|
||||||
use crate::utils::{require_option, which, PathExt};
|
use crate::utils::{require_option, which, PathExt};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
@@ -53,15 +53,19 @@ impl Powershell {
|
|||||||
self.profile.as_ref()
|
self.profile.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_modules(&self, run_type: RunType) -> Result<()> {
|
pub fn update_modules(&self, ctx: &ExecutionContext) -> Result<()> {
|
||||||
let powershell = require_option(self.path.as_ref())?;
|
let powershell = require_option(self.path.as_ref())?;
|
||||||
|
|
||||||
print_separator("Powershell Modules Update");
|
print_separator("Powershell Modules Update");
|
||||||
|
|
||||||
|
let cmd = if ctx.config().yes() {
|
||||||
|
"Update-Module -AcceptLicense -Force"
|
||||||
|
} else {
|
||||||
|
"Update-Module"
|
||||||
|
};
|
||||||
|
|
||||||
println!("Updating modules...");
|
println!("Updating modules...");
|
||||||
run_type
|
ctx.run_type().execute(&powershell).args(&["-Command", cmd]).check_run()
|
||||||
.execute(&powershell)
|
|
||||||
.args(&["-Command", "Update-Module"])
|
|
||||||
.check_run()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
|||||||
Reference in New Issue
Block a user