fix: Lazy load git repo and only run module if not disabled (#306)

A couple of optimizations are done in this PR. One, we now will check config ahead of time to see if a module is disabled before running any module code. Also, we won't try to discover a git repository unless the module requests access to it.
This commit is contained in:
Neil Kistner
2019-09-09 18:14:38 -05:00
committed by Matan Kushner
parent dc8409333e
commit 9f70ffb7a7
30 changed files with 111 additions and 177 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
Some(ruby_version) => {
const RUBY_CHAR: &str = "💎 ";
let mut module = context.new_module("ruby")?;
let mut module = context.new_module("ruby");
let module_style = module
.config_value_style("style")
.unwrap_or_else(|| Color::Red.bold());