Add support for the micro text editor (#635)

This commit is contained in:
M*C*O
2021-02-15 20:43:36 +01:00
committed by GitHub
parent f2b5530764
commit 513ffb8f22
3 changed files with 18 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ use anyhow::Result;
use directories::BaseDirs;
use log::debug;
use std::env;
use std::io::Write;
use std::path::PathBuf;
use std::process::Command;
use tempfile::tempfile_in;
@@ -101,6 +102,21 @@ pub fn run_vscode(run_type: RunType) -> Result<()> {
Ok(())
}
pub fn run_micro(run_type: RunType) -> Result<()> {
let micro = utils::require("micro")?;
print_separator("micro");
let stdout = run_type.execute(&micro).args(&["-plugin", "update"]).string_output()?;
std::io::stdout().write_all(&stdout.as_bytes())?;
if stdout.contains("Nothing to install / update") || stdout.contains("One or more plugins installed") {
Ok(())
} else {
Err(anyhow::anyhow!("micro output does not indicate success: {}", stdout))
}
}
#[cfg(not(any(
target_os = "freebsd",
target_os = "openbsd",