Add a command for editing the configuration

This commit is contained in:
Roey Darwish Dror
2019-08-22 22:29:31 +03:00
parent be8b726846
commit 3c71ce019b
3 changed files with 52 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
use super::error::{Error, ErrorKind};
use log::{debug, error};
use std::env;
use std::ffi::OsStr;
use std::fmt::{self, Debug};
use std::path::{Component, Path, PathBuf};
@@ -138,6 +139,10 @@ impl<'a> fmt::Display for HumanizedPath<'a> {
}
}
pub fn editor() -> String {
env::var("EDITOR").unwrap_or_else(|_| String::from(if cfg!(windows) { "notepad" } else { "vi" }))
}
#[cfg(test)]
#[cfg(windows)]
mod tests {