diff options
author | Matan Kushner <hello@matchai.me> | 2019-07-02 16:12:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-02 16:12:53 -0400 |
commit | 463ec260247fa0e62d2ea14e237681a499955392 (patch) | |
tree | 0d7ed8d19187c298c2e7764f21387a919d21877c /src/print.rs | |
parent | 2440ed60d0a315e6248c040d2a114f7deeea6260 (diff) |
feat: Add a `disabled` configuration option for modules (#86)
• Add support for the disabled configuration option
This will allow you to selectively disable modules that you don't want or need. 😄
• Overwrite starship configuration file path with STARSHIP_CONFIG environment variable
• Write tests for the two configuration options that are available
Diffstat (limited to 'src/print.rs')
-rw-r--r-- | src/print.rs | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/print.rs b/src/print.rs index 71d453e34..ae712e123 100644 --- a/src/print.rs +++ b/src/print.rs @@ -6,21 +6,22 @@ use crate::context::Context; use crate::module::Module; use crate::modules; +const PROMPT_ORDER: &[&str] = &[ + "battery", + "username", + "directory", + "git_branch", + "git_status", + "package", + "nodejs", + "rust", + "python", + "go", + "line_break", + "character", +]; + pub fn prompt(args: ArgMatches) { - let prompt_order = vec![ - "battery", - "username", - "directory", - "git_branch", - "git_status", - "package", - "nodejs", - "rust", - "python", - "go", - "line_break", - "character", - ]; let context = Context::new(args); let stdout = io::stdout(); @@ -29,7 +30,7 @@ pub fn prompt(args: ArgMatches) { // Write a new line before the prompt writeln!(handle).unwrap(); - let modules = prompt_order + let modules = PROMPT_ORDER .par_iter() .map(|module| modules::handle(module, &context)) // Compute modules .flatten() |