From 463ec260247fa0e62d2ea14e237681a499955392 Mon Sep 17 00:00:00 2001 From: Matan Kushner Date: Tue, 2 Jul 2019 16:12:53 -0400 Subject: feat: Add a `disabled` configuration option for modules (#86) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • 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 --- src/modules/battery.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/modules/battery.rs') 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> { +pub fn module<'a>(context: &'a Context) -> Option> { const BATTERY_FULL: &str = "•"; const BATTERY_CHARGING: &str = "⇡"; const BATTERY_DISCHARGING: &str = "⇣"; @@ -22,7 +22,7 @@ pub fn segment<'a>(context: &'a Context) -> Option> { } // 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 { 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 => { -- cgit v1.2.3