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:
parent
f7754455e6
commit
0fa862a2e9
|
@ -20,6 +20,9 @@ is-it-maintained-issue-resolution = { repository = "starship/starship" }
|
||||||
is-it-maintained-open-issues = { repository = "starship/starship" }
|
is-it-maintained-open-issues = { repository = "starship/starship" }
|
||||||
maintenance = { status = "actively-developed" }
|
maintenance = { status = "actively-developed" }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["battery"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.33.0"
|
clap = "2.33.0"
|
||||||
ansi_term = "0.12.0"
|
ansi_term = "0.12.0"
|
||||||
|
@ -30,7 +33,9 @@ serde_json = "1.0.40"
|
||||||
rayon = "1.1.0"
|
rayon = "1.1.0"
|
||||||
pretty_env_logger = "0.3.1"
|
pretty_env_logger = "0.3.1"
|
||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
battery = "0.7.4"
|
# battery is optional (on by default) because the crate doesn't currently build for Termux
|
||||||
|
# see: https://github.com/svartalf/rust-battery/issues/33
|
||||||
|
battery = { version = "0.7.4", optional = true }
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
path-slash = "0.1.1"
|
path-slash = "0.1.1"
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ use std::fmt;
|
||||||
|
|
||||||
// List of all modules
|
// List of all modules
|
||||||
pub const ALL_MODULES: &[&str] = &[
|
pub const ALL_MODULES: &[&str] = &[
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
"battery",
|
"battery",
|
||||||
"character",
|
"character",
|
||||||
"cmd_duration",
|
"cmd_duration",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// While adding out new module add out module to src/module.rs ALL_MODULES const array also.
|
// While adding out new module add out module to src/module.rs ALL_MODULES const array also.
|
||||||
mod battery;
|
|
||||||
mod character;
|
mod character;
|
||||||
mod cmd_duration;
|
mod cmd_duration;
|
||||||
mod directory;
|
mod directory;
|
||||||
|
@ -16,6 +15,9 @@ mod ruby;
|
||||||
mod rust;
|
mod rust;
|
||||||
mod username;
|
mod username;
|
||||||
|
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
|
mod battery;
|
||||||
|
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::module::Module;
|
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_branch" => git_branch::module(context),
|
||||||
"git_status" => git_status::module(context),
|
"git_status" => git_status::module(context),
|
||||||
"username" => username::module(context),
|
"username" => username::module(context),
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
"battery" => battery::module(context),
|
"battery" => battery::module(context),
|
||||||
"cmd_duration" => cmd_duration::module(context),
|
"cmd_duration" => cmd_duration::module(context),
|
||||||
"jobs" => jobs::module(context),
|
"jobs" => jobs::module(context),
|
||||||
|
|
|
@ -26,6 +26,7 @@ const DEFAULT_PROMPT_ORDER: &[&str] = &[
|
||||||
"cmd_duration",
|
"cmd_duration",
|
||||||
"line_break",
|
"line_break",
|
||||||
"jobs",
|
"jobs",
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
"battery",
|
"battery",
|
||||||
"character",
|
"character",
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue