diff options
Diffstat (limited to 'src/config/utils.rs')
-rw-r--r-- | src/config/utils.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/config/utils.rs b/src/config/utils.rs index 5251549..a5436ee 100644 --- a/src/config/utils.rs +++ b/src/config/utils.rs @@ -1,8 +1,8 @@ -use crate::display::Color; +use crate::display::color::Color; use std::convert::TryFrom; use std::env; -pub(in crate::config) fn get_input(config: &git2::Config, name: &str, default: &str) -> Result<String, String> { +pub(super) fn get_input(config: &git2::Config, name: &str, default: &str) -> Result<String, String> { let value = get_string(config, name, default)?; match value.to_lowercase().as_ref() { @@ -24,7 +24,7 @@ pub(in crate::config) fn get_input(config: &git2::Config, name: &str, default: & } } -pub(in crate::config) fn get_string(config: &git2::Config, name: &str, default: &str) -> Result<String, String> { +pub(super) fn get_string(config: &git2::Config, name: &str, default: &str) -> Result<String, String> { match config.get_string(name) { Ok(v) => Ok(v), Err(ref e) if e.code() == git2::ErrorCode::NotFound => Ok(String::from(default)), @@ -32,7 +32,7 @@ pub(in crate::config) fn get_string(config: &git2::Config, name: &str, default: } } -pub(in crate::config) fn get_bool(config: &git2::Config, name: &str, default: bool) -> Result<bool, String> { +pub(super) fn get_bool(config: &git2::Config, name: &str, default: bool) -> Result<bool, String> { match config.get_bool(name) { Ok(v) => Ok(v), Err(ref e) if e.code() == git2::ErrorCode::NotFound => Ok(default), @@ -40,7 +40,7 @@ pub(in crate::config) fn get_bool(config: &git2::Config, name: &str, default: bo } } -pub(in crate::config) fn get_color(config: &git2::Config, name: &str, default_color: Color) -> Result<Color, String> { +pub(super) fn get_color(config: &git2::Config, name: &str, default_color: Color) -> Result<Color, String> { match config.get_string(name) { Ok(v) => Color::try_from(v.to_lowercase().as_str()), Err(ref e) if e.code() == git2::ErrorCode::NotFound => Ok(default_color), @@ -48,13 +48,13 @@ pub(in crate::config) fn get_color(config: &git2::Config, name: &str, default_co } } -pub(in crate::config) fn editor_from_env() -> String { +pub(super) fn editor_from_env() -> String { env::var("VISUAL") .or_else(|_| env::var("EDITOR")) .unwrap_or_else(|_| String::from("vi")) } -pub(in crate::config) fn open_git_config() -> Result<git2::Config, String> { +pub(super) fn open_git_config() -> Result<git2::Config, String> { match git2::Repository::open_from_env() { Ok(f) => { match f.config() { |