Support for updating kakoune plugins with kak-plug (#852)

This commit is contained in:
Leonardo Eugênio
2022-02-06 18:48:06 -03:00
committed by GitHub
parent 54e3d87b23
commit 0251c2769b
5 changed files with 40 additions and 0 deletions

View File

@@ -94,6 +94,7 @@ pub enum Step {
GnomeShellExtensions, GnomeShellExtensions,
HomeManager, HomeManager,
Jetpack, Jetpack,
Kakoune,
Krew, Krew,
Macports, Macports,
Mas, Mas,

View File

@@ -308,6 +308,7 @@ fn run() -> Result<()> {
runner.execute(Step::Vim, "vim", || vim::upgrade_vim(&base_dirs, &ctx))?; runner.execute(Step::Vim, "vim", || vim::upgrade_vim(&base_dirs, &ctx))?;
runner.execute(Step::Vim, "Neovim", || vim::upgrade_neovim(&base_dirs, &ctx))?; runner.execute(Step::Vim, "Neovim", || vim::upgrade_neovim(&base_dirs, &ctx))?;
runner.execute(Step::Vim, "voom", || vim::run_voom(&base_dirs, run_type))?; runner.execute(Step::Vim, "voom", || vim::run_voom(&base_dirs, run_type))?;
runner.execute(Step::Kakoune, "Kakoune", || kakoune::upgrade_kak_plug(&ctx))?;
runner.execute(Step::Node, "npm", || node::run_npm_upgrade(&ctx))?; runner.execute(Step::Node, "npm", || node::run_npm_upgrade(&ctx))?;
runner.execute(Step::Pnpm, "pnpm", || node::pnpm_global_update(&ctx))?; runner.execute(Step::Pnpm, "pnpm", || node::pnpm_global_update(&ctx))?;
runner.execute(Step::Deno, "deno", || node::deno_upgrade(&ctx))?; runner.execute(Step::Deno, "deno", || node::deno_upgrade(&ctx))?;

31
src/steps/kakoune.rs Normal file
View File

@@ -0,0 +1,31 @@
use crate::error::TopgradeError;
use crate::terminal::print_separator;
use crate::utils::require;
use anyhow::Result;
use crate::execution_context::ExecutionContext;
use crate::executor::ExecutorOutput;
const UPGRADE_KAK: &str = include_str!("upgrade.kak");
pub fn upgrade_kak_plug(ctx: &ExecutionContext) -> Result<()> {
let kak = require("kak")?;
print_separator("Kakoune");
let mut command = ctx.run_type().execute(&kak);
command.args(&["-ui", "dummy", "-e", UPGRADE_KAK]);
let output = command.output()?;
if let ExecutorOutput::Wet(output) = output {
let status = output.status;
if !status.success() {
return Err(TopgradeError::ProcessFailed(status).into());
} else {
println!("Plugins upgraded")
}
}
Ok(())
}

View File

@@ -1,6 +1,7 @@
pub mod emacs; pub mod emacs;
pub mod generic; pub mod generic;
pub mod git; pub mod git;
pub mod kakoune;
pub mod node; pub mod node;
pub mod os; pub mod os;
pub mod powershell; pub mod powershell;

6
src/steps/upgrade.kak Normal file
View File

@@ -0,0 +1,6 @@
try %{
set global plug_block_ui true;
plug-update;
}
quit 0;