diff options
author | Tom Hotston <Hotston.tom@Gmail.com> | 2019-09-30 06:26:32 +0100 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-09-30 14:26:32 +0900 |
commit | 7588137b09f7706cc404a986113b277d99fde859 (patch) | |
tree | 668ec37c88ef3b4782d12d3205c85fb64f5a0fcd /src/modules | |
parent | 61604a4a8e7f407290ef4cf5205be6f4e2fd4dcf (diff) |
feat: Added ability for setting command duration prefix (#414)
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/cmd_duration.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/modules/cmd_duration.rs b/src/modules/cmd_duration.rs index 35a7e6858..8d4816392 100644 --- a/src/modules/cmd_duration.rs +++ b/src/modules/cmd_duration.rs @@ -16,6 +16,11 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { .parse::<u64>() .ok()?; + let prefix = module + .config_value_str("prefix") + .unwrap_or("took ") + .to_owned(); + let signed_config_min = module.config_value_i64("min_time").unwrap_or(2); /* TODO: Once error handling is implemented, warn the user if their config @@ -38,7 +43,10 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { }; module.set_style(module_color); - module.new_segment("cmd_duration", &format!("took {}", render_time(elapsed))); + module.new_segment( + "cmd_duration", + &format!("{}{}", prefix, render_time(elapsed)), + ); module.get_prefix().set_value(""); Some(module) |