diff options
author | Zhenhui Xie <xiezh0831@yahoo.co.jp> | 2019-11-06 21:00:31 +0800 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-11-06 22:00:31 +0900 |
commit | a3d5ea3e432434fd5b2100ce4611e5193236c1bd (patch) | |
tree | 573d70f37094c1aa471303add3a1f7e466e12d8c /src/configs/git_state.rs | |
parent | 48726fdd2a45fb530dd1bb16d195a82c7eee8823 (diff) |
refactor: Refactor git state module to use module config (#605)
Diffstat (limited to 'src/configs/git_state.rs')
-rw-r--r-- | src/configs/git_state.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/configs/git_state.rs b/src/configs/git_state.rs new file mode 100644 index 000000000..c528e4e6e --- /dev/null +++ b/src/configs/git_state.rs @@ -0,0 +1,35 @@ +use crate::config::{ModuleConfig, RootModuleConfig, SegmentConfig}; + +use ansi_term::{Color, Style}; +use starship_module_config_derive::ModuleConfig; + +#[derive(Clone, ModuleConfig)] +pub struct GitStateConfig<'a> { + pub rebase: SegmentConfig<'a>, + pub merge: SegmentConfig<'a>, + pub revert: SegmentConfig<'a>, + pub cherry_pick: SegmentConfig<'a>, + pub bisect: SegmentConfig<'a>, + pub am: SegmentConfig<'a>, + pub am_or_rebase: SegmentConfig<'a>, + pub progress_divider: SegmentConfig<'a>, + pub style: Style, + pub disabled: bool, +} + +impl<'a> RootModuleConfig<'a> for GitStateConfig<'a> { + fn new() -> Self { + GitStateConfig { + rebase: SegmentConfig::new("REBASING"), + merge: SegmentConfig::new("MERGING"), + revert: SegmentConfig::new("REVERTING"), + cherry_pick: SegmentConfig::new("CHERRY-PICKING"), + bisect: SegmentConfig::new("BISECTING"), + am: SegmentConfig::new("AM"), + am_or_rebase: SegmentConfig::new("AM/REBASE"), + progress_divider: SegmentConfig::new("/"), + style: Color::Yellow.bold(), + disabled: false, + } + } +} |