make the battery module optional for now (#234)

The 'battery' crate doesn't support Termux, so we are temporarily making the battery module optional.
This commit is contained in:
Bruno Bigras
2019-08-26 14:09:39 -04:00
committed by Matan Kushner
parent f7754455e6
commit 0fa862a2e9
4 changed files with 12 additions and 2 deletions
+1
View File
@@ -6,6 +6,7 @@ use std::fmt;
// List of all modules
pub const ALL_MODULES: &[&str] = &[
#[cfg(feature = "battery")]
"battery",
"character",
"cmd_duration",
+4 -1
View File
@@ -1,5 +1,4 @@
// While adding out new module add out module to src/module.rs ALL_MODULES const array also.
mod battery;
mod character;
mod cmd_duration;
mod directory;
@@ -16,6 +15,9 @@ mod ruby;
mod rust;
mod username;
#[cfg(feature = "battery")]
mod battery;
use crate::context::Context;
use crate::module::Module;
@@ -33,6 +35,7 @@ pub fn handle<'a>(module: &str, context: &'a Context) -> Option<Module<'a>> {
"git_branch" => git_branch::module(context),
"git_status" => git_status::module(context),
"username" => username::module(context),
#[cfg(feature = "battery")]
"battery" => battery::module(context),
"cmd_duration" => cmd_duration::module(context),
"jobs" => jobs::module(context),
+1
View File
@@ -26,6 +26,7 @@ const DEFAULT_PROMPT_ORDER: &[&str] = &[
"cmd_duration",
"line_break",
"jobs",
#[cfg(feature = "battery")]
"battery",
"character",
];