Skip to main content

git_su/
config_repository.rs

1// ConfigRepository: gitsu.defaultSelectScope, gitsu.groupEmailAddress
2
3use crate::git::{Git, Scope};
4
5pub struct ConfigRepository;
6
7impl ConfigRepository {
8    pub fn default_select_scope() -> Scope {
9        let v = Git::get_config(Scope::Derived, "gitsu.defaultSelectScope");
10        let v = v.trim();
11        if v.is_empty() {
12            return Scope::Local;
13        }
14        match v {
15            "local" => Scope::Local,
16            "global" => Scope::Global,
17            "system" => Scope::System,
18            _ => Scope::Local,
19        }
20    }
21
22    pub fn group_email_address() -> String {
23        let v = Git::get_config(Scope::Derived, "gitsu.groupEmailAddress");
24        let v = v.trim();
25        if v.is_empty() {
26            "dev@example.com".to_string()
27        } else {
28            v.to_string()
29        }
30    }
31}