rename all crates

This commit is contained in:
steven-omaha
2023-02-14 13:12:08 +01:00
parent c7841ae346
commit e7cb7d9321
42 changed files with 119 additions and 93 deletions
+15
View File
@@ -0,0 +1,15 @@
use std::env::var;
use anyhow::{anyhow, Result};
pub fn get_editor() -> Result<String> {
check_vars_in_order(&["EDITOR", "VISUAL"]).ok_or_else(|| anyhow!("could not find editor"))
}
fn check_vars_in_order(vars: &[&str]) -> Option<String> {
vars.iter().find_map(|v| var(v).ok())
}
pub fn get_single_var(variable: &str) -> Option<String> {
var(variable).ok()
}