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/character.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/character.rs')
-rw-r--r-- | src/modules/character.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/character.rs b/src/modules/character.rs index 1dfc27991..1a55cf78f 100644 --- a/src/modules/character.rs +++ b/src/modules/character.rs @@ -9,12 +9,12 @@ use ansi_term::Color; /// (green by default) /// - If the exit-code was anything else, the arrow will be formatted with /// `COLOR_FAILURE` (red by default) -pub fn segment(context: &Context) -> Option<Module> { +pub fn segment<'a>(context: &'a Context) -> Option<Module<'a>> { const PROMPT_CHAR: &str = "➜"; let color_success = Color::Green.bold(); let color_failure = Color::Red.bold(); - let mut module = Module::new("char"); + let mut module = context.new_module("char"); module.get_prefix().set_value(""); let symbol = module.new_segment("symbol", PROMPT_CHAR); |