Add CommandExt trait (#146)
* Color CI output * Improve `CommandExt` * Add comments explaining `#[allow]`s * Remove useless `dead_code` annotation * Improve error messages * Print errors when running a shell errors * fixup! Remove useless `dead_code` annotation
This commit is contained in:
committed by
Thomas Schönauer
parent
bd34a3bcd4
commit
e84173be8f
@@ -1,4 +1,10 @@
|
||||
#![allow(dead_code)]
|
||||
use std::collections::BTreeMap;
|
||||
use std::fs::write;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::{env, fs};
|
||||
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use clap::{ArgEnum, Parser};
|
||||
@@ -6,15 +12,12 @@ use directories::BaseDirs;
|
||||
use log::debug;
|
||||
use regex::Regex;
|
||||
use serde::Deserialize;
|
||||
use std::collections::BTreeMap;
|
||||
use std::fs::write;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::{env, fs};
|
||||
use strum::{EnumIter, EnumString, EnumVariantNames, IntoEnumIterator};
|
||||
use sys_info::hostname;
|
||||
use which_crate::which;
|
||||
|
||||
use crate::command::CommandExt;
|
||||
|
||||
use super::utils::editor;
|
||||
|
||||
pub static EXAMPLE_CONFIG: &str = include_str!("../config.example.toml");
|
||||
@@ -389,9 +392,8 @@ impl ConfigFile {
|
||||
Command::new(command)
|
||||
.args(args)
|
||||
.arg(config_path)
|
||||
.spawn()
|
||||
.and_then(|mut p| p.wait())?;
|
||||
Ok(())
|
||||
.status_checked()
|
||||
.context("Failed to open configuration file editor")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user