diff options
author | Matan Kushner <hello@matchai.me> | 2019-06-10 15:56:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-10 15:56:17 +0100 |
commit | 097f1b05f1d82967fe2a900ccf7ba3597c04ad77 (patch) | |
tree | e5419607802145bf2521defd9823d224f937b653 /src/modules/nodejs.rs | |
parent | 8239fbd12befad1126e677fa083ce73947d74d8c (diff) |
Add support for prompt configuration (#62)
- Create `Config` struct that is added to `Context` when initialized
- Read `~/.confg/starship.toml` during initialization (can be updated later to also look at `$XDG_CONFIG_HOME`)
- `Context` now has a method for creating modules. This allows us to provide modules with a reference to the configuration specific to that module
Diffstat (limited to 'src/modules/nodejs.rs')
-rw-r--r-- | src/modules/nodejs.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/nodejs.rs b/src/modules/nodejs.rs index b9736687e..e542acf1e 100644 --- a/src/modules/nodejs.rs +++ b/src/modules/nodejs.rs @@ -9,7 +9,7 @@ use super::{Context, Module}; /// - Current directory contains a `.js` file /// - Current directory contains a `package.json` file /// - Current directory contains a `node_modules` directory -pub fn segment(context: &Context) -> Option<Module> { +pub fn segment<'a>(context: &'a Context) -> Option<Module<'a>> { let is_js_project = context .new_scan_dir() .set_files(&["package.json"]) @@ -26,7 +26,7 @@ pub fn segment(context: &Context) -> Option<Module> { const NODE_CHAR: &str = "⬢ "; let module_color = Color::Green.bold(); - let mut module = Module::new("node"); + let mut module = context.new_module("node"); module.set_style(module_color); let formatted_version = node_version.trim(); |