summaryrefslogtreecommitdiffstats
path: root/src/configs
diff options
context:
space:
mode:
authorBrian Low <github@brianlow.com>2019-10-26 00:20:20 -0600
committerMatan Kushner <hello@matchai.me>2019-10-26 15:20:20 +0900
commit2710d0270946fc3ba83eeabd9d7ec4cdc86f36bb (patch)
tree7ee499d73e57225250a2e2a22ca8cb973247bbb9 /src/configs
parent59148ac4add692e208f6268155151da1335ba8b7 (diff)
feat: Show git_status counts (#434)
The git_status module can show the count of files next to their respective symbols.
Diffstat (limited to 'src/configs')
-rw-r--r--src/configs/git_status.rs63
-rw-r--r--src/configs/mod.rs1
2 files changed, 64 insertions, 0 deletions
diff --git a/src/configs/git_status.rs b/src/configs/git_status.rs
new file mode 100644
index 000000000..028274df9
--- /dev/null
+++ b/src/configs/git_status.rs
@@ -0,0 +1,63 @@
+use crate::config::{ModuleConfig, RootModuleConfig, SegmentConfig};
+
+use ansi_term::{Color, Style};
+use starship_module_config_derive::ModuleConfig;
+
+#[derive(Clone, ModuleConfig)]
+pub struct GitStatusConfig<'a> {
+ pub stashed: SegmentConfig<'a>,
+ pub ahead: SegmentConfig<'a>,
+ pub behind: SegmentConfig<'a>,
+ pub diverged: SegmentConfig<'a>,
+ pub show_sync_count: bool,
+ pub conflicted: SegmentConfig<'a>,
+ pub conflicted_count: CountConfig,
+ pub deleted: SegmentConfig<'a>,
+ pub deleted_count: CountConfig,
+ pub renamed: SegmentConfig<'a>,
+ pub renamed_count: CountConfig,
+ pub modified: SegmentConfig<'a>,
+ pub modified_count: CountConfig,
+ pub staged: SegmentConfig<'a>,
+ pub staged_count: CountConfig,
+ pub untracked: SegmentConfig<'a>,
+ pub untracked_count: CountConfig,
+ pub prefix: &'a str,
+ pub suffix: &'a str,
+ pub style: Style,
+ pub disabled: bool,
+}
+
+impl<'a> RootModuleConfig<'a> for GitStatusConfig<'a> {
+ fn new() -> Self {
+ GitStatusConfig {
+ stashed: SegmentConfig::new("$"),
+ ahead: SegmentConfig::new("⇡"),
+ behind: SegmentConfig::new("⇣"),
+ diverged: SegmentConfig::new("⇕"),
+ conflicted: SegmentConfig::new("="),
+ show_sync_count: false,
+ conflicted_count: CountConfig::default(),
+ deleted: SegmentConfig::new("✘"),
+ deleted_count: CountConfig::default(),
+ renamed: SegmentConfig::new("»"),
+ renamed_count: CountConfig::default(),
+ modified: SegmentConfig::new("!"),
+ modified_count: CountConfig::default(),
+ staged: SegmentConfig::new("+"),
+ staged_count: CountConfig::default(),
+ untracked: SegmentConfig::new("?"),
+ untracked_count: CountConfig::default(),
+ prefix: "[",
+ suffix: "] ",
+ style: Color::Red.bold(),
+ disabled: false,
+ }
+ }
+}
+
+#[derive(Clone, Copy, ModuleConfig, Default)]
+pub struct CountConfig {
+ pub enabled: bool,
+ pub style: Option<Style>,
+}
diff --git a/src/configs/mod.rs b/src/configs/mod.rs
index 0025c683d..62bae5842 100644
--- a/src/configs/mod.rs
+++ b/src/configs/mod.rs
@@ -7,6 +7,7 @@ pub mod directory;
pub mod dotnet;
pub mod env_var;
pub mod git_branch;
+pub mod git_status;
pub mod go;
pub mod hostname;
pub mod jobs;