summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKutsuzawa Ryo <kutsuzawa2851@gmail.com>2019-09-16 05:44:53 +0900
committerMatan Kushner <hello@matchai.me>2019-09-15 16:44:53 -0400
commit7a98ec1d8e9365feb74d18e115862dd2952ce433 (patch)
tree8f390bfb109aad5423ff1911ed1fb798f8cc666e /src
parent8014e9276ee704882ed6ba84960bb5fe00606aa2 (diff)
feat: Add configuration for the `git_status` prefix and suffix (#367)
Diffstat (limited to 'src')
-rw-r--r--src/modules/git_status.rs22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/modules/git_status.rs b/src/modules/git_status.rs
index badf0face..9b97a2f24 100644
--- a/src/modules/git_status.rs
+++ b/src/modules/git_status.rs
@@ -29,6 +29,8 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
const GIT_STATUS_ADDED: &str = "+";
const GIT_STATUS_RENAMED: &str = "»";
const GIT_STATUS_DELETED: &str = "✘";
+ const PREFIX: &str = "[";
+ const SUFFIX: &str = "] ";
let repo = context.get_repo().ok()?;
let branch_name = repo.branch.as_ref()?;
@@ -40,9 +42,23 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let module_style = module
.config_value_style("style")
.unwrap_or_else(|| Color::Red.bold());
-
- module.get_prefix().set_value("[").set_style(module_style);
- module.get_suffix().set_value("] ").set_style(module_style);
+ let start_symbol = module
+ .config_value_str("prefix")
+ .unwrap_or(PREFIX)
+ .to_owned();
+ let end_symbol = module
+ .config_value_str("suffix")
+ .unwrap_or(SUFFIX)
+ .to_owned();
+
+ module
+ .get_prefix()
+ .set_value(start_symbol)
+ .set_style(module_style);
+ module
+ .get_suffix()
+ .set_value(end_symbol)
+ .set_style(module_style);
module.set_style(module_style);
let ahead_behind = get_ahead_behind(&repository, branch_name);