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

@@ -86,6 +86,7 @@ pub enum Step {
Jetpack, Jetpack,
Krew, Krew,
MacPorts, MacPorts,
Micro,
MicrosoftAutoUpdate, MicrosoftAutoUpdate,
Myrepos, Myrepos,
Nix, Nix,

View File

@@ -309,6 +309,7 @@ fn run() -> Result<()> {
runner.execute(Step::Gcloud, "gcloud", || { runner.execute(Step::Gcloud, "gcloud", || {
generic::run_gcloud_components_update(run_type) generic::run_gcloud_components_update(run_type)
})?; })?;
runner.execute(Step::Micro, "micro", || generic::run_micro(run_type))?;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ {

View File

@@ -11,6 +11,7 @@ use anyhow::Result;
use directories::BaseDirs; use directories::BaseDirs;
use log::debug; use log::debug;
use std::env; use std::env;
use std::io::Write;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::Command; use std::process::Command;
use tempfile::tempfile_in; use tempfile::tempfile_in;
@@ -101,6 +102,21 @@ pub fn run_vscode(run_type: RunType) -> Result<()> {
Ok(()) 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( #[cfg(not(any(
target_os = "freebsd", target_os = "freebsd",
target_os = "openbsd", target_os = "openbsd",