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/modules/battery.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/modules/battery.rs')
-rw-r--r-- | src/modules/battery.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/modules/battery.rs b/src/modules/battery.rs index 75ac1c554..048abe05f 100644 --- a/src/modules/battery.rs +++ b/src/modules/battery.rs @@ -3,7 +3,7 @@ use ansi_term::Color; use super::{Context, Module}; /// Creates a segment for the battery percentage and charging state -pub fn segment<'a>(context: &'a Context) -> Option<Module<'a>> { +pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { const BATTERY_FULL: &str = "•"; const BATTERY_CHARGING: &str = "⇡"; const BATTERY_DISCHARGING: &str = "⇣"; @@ -22,7 +22,7 @@ pub fn segment<'a>(context: &'a Context) -> Option<Module<'a>> { } // TODO: Set style based on percentage when threshold is modifiable - let mut module = context.new_module("battery"); + let mut module = context.new_module("battery")?; module.set_style(Color::Red.bold()); module.get_prefix().set_value(""); @@ -61,7 +61,7 @@ fn get_battery_status() -> Option<BatteryStatus> { Some(battery_status) } Some(Err(e)) => { - log::debug!("Unable to access battery information:\n{}", e); + log::debug!("Unable to access battery information:\n{}", &e); None } None => { |