Pass --force to doom when -y is set (fix #799)
This commit is contained in:
@@ -292,7 +292,7 @@ fn run() -> Result<()> {
|
|||||||
runner.execute(Step::Choosenim, "choosenim", || generic::run_choosenim(&ctx))?;
|
runner.execute(Step::Choosenim, "choosenim", || generic::run_choosenim(&ctx))?;
|
||||||
runner.execute(Step::Cargo, "cargo", || generic::run_cargo_update(&ctx))?;
|
runner.execute(Step::Cargo, "cargo", || generic::run_cargo_update(&ctx))?;
|
||||||
runner.execute(Step::Flutter, "Flutter", || generic::run_flutter_upgrade(run_type))?;
|
runner.execute(Step::Flutter, "Flutter", || generic::run_flutter_upgrade(run_type))?;
|
||||||
runner.execute(Step::Emacs, "Emacs", || emacs.upgrade(run_type))?;
|
runner.execute(Step::Emacs, "Emacs", || emacs.upgrade(&ctx))?;
|
||||||
runner.execute(Step::Opam, "opam", || generic::run_opam_update(run_type))?;
|
runner.execute(Step::Opam, "opam", || generic::run_opam_update(run_type))?;
|
||||||
runner.execute(Step::Vcpkg, "vcpkg", || generic::run_vcpkg_update(run_type))?;
|
runner.execute(Step::Vcpkg, "vcpkg", || generic::run_vcpkg_update(run_type))?;
|
||||||
runner.execute(Step::Pipx, "pipx", || generic::run_pipx_update(run_type))?;
|
runner.execute(Step::Pipx, "pipx", || generic::run_pipx_update(run_type))?;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::executor::RunType;
|
use crate::execution_context::ExecutionContext;
|
||||||
use crate::terminal::print_separator;
|
use crate::terminal::print_separator;
|
||||||
use crate::utils::{require, require_option, PathExt};
|
use crate::utils::{require, require_option, PathExt};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
@@ -60,25 +60,32 @@ impl Emacs {
|
|||||||
self.directory.as_ref()
|
self.directory.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_doom(doom: &Path, run_type: RunType) -> Result<()> {
|
fn update_doom(doom: &Path, ctx: &ExecutionContext) -> Result<()> {
|
||||||
print_separator("Doom Emacs");
|
print_separator("Doom Emacs");
|
||||||
|
|
||||||
run_type.execute(doom).args(&["-y", "upgrade"]).check_run()
|
let mut command = ctx.run_type().execute(doom);
|
||||||
|
command.args(&["-y", "upgrade"]);
|
||||||
|
|
||||||
|
if ctx.config().yes() {
|
||||||
|
command.arg("--force");
|
||||||
|
}
|
||||||
|
|
||||||
|
command.check_run()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn upgrade(&self, run_type: RunType) -> Result<()> {
|
pub fn upgrade(&self, ctx: &ExecutionContext) -> Result<()> {
|
||||||
let emacs = require("emacs")?;
|
let emacs = require("emacs")?;
|
||||||
let init_file = require_option(self.directory.as_ref(), String::from("Emacs directory does not exist"))?
|
let init_file = require_option(self.directory.as_ref(), String::from("Emacs directory does not exist"))?
|
||||||
.join("init.el")
|
.join("init.el")
|
||||||
.require()?;
|
.require()?;
|
||||||
|
|
||||||
if let Some(doom) = &self.doom {
|
if let Some(doom) = &self.doom {
|
||||||
return Emacs::update_doom(doom, run_type);
|
return Emacs::update_doom(doom, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_separator("Emacs");
|
print_separator("Emacs");
|
||||||
|
|
||||||
let mut command = run_type.execute(&emacs);
|
let mut command = ctx.run_type().execute(&emacs);
|
||||||
|
|
||||||
command
|
command
|
||||||
.args(&["--batch", "--debug-init", "-l"])
|
.args(&["--batch", "--debug-init", "-l"])
|
||||||
|
|||||||
Reference in New Issue
Block a user