2020-07-07 22:45:32 +00:00
|
|
|
use crate::config::{ModuleConfig, RootModuleConfig};
|
2019-12-06 16:57:42 +00:00
|
|
|
|
|
|
|
use starship_module_config_derive::ModuleConfig;
|
|
|
|
|
|
|
|
#[derive(Clone, ModuleConfig)]
|
|
|
|
pub struct GitCommitConfig<'a> {
|
|
|
|
pub commit_hash_length: usize,
|
2020-07-07 22:45:32 +00:00
|
|
|
pub format: &'a str,
|
|
|
|
pub style: &'a str,
|
2020-02-12 19:56:29 +00:00
|
|
|
pub only_detached: bool,
|
2019-12-06 16:57:42 +00:00
|
|
|
pub disabled: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> RootModuleConfig<'a> for GitCommitConfig<'a> {
|
|
|
|
fn new() -> Self {
|
|
|
|
GitCommitConfig {
|
|
|
|
// be consistent with git by default, which has DEFAULT_ABBREV set to 7
|
|
|
|
commit_hash_length: 7,
|
2020-07-07 22:45:32 +00:00
|
|
|
format: "[\\($hash\\)]($style) ",
|
|
|
|
style: "green bold",
|
2020-02-12 19:56:29 +00:00
|
|
|
only_detached: true,
|
|
|
|
disabled: false,
|
2019-12-06 16:57:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|