mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-16 10:05:13 +00:00
chore: Remove logic for the disabled
option from modules (#486)
This commit is contained in:
parent
2bfc98641d
commit
6c6e0ef1dd
@ -12,10 +12,6 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
|||||||
|
|
||||||
let mut module = context.new_module("memory_usage");
|
let mut module = context.new_module("memory_usage");
|
||||||
|
|
||||||
if module.config_value_bool("disabled").unwrap_or(true) {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let module_style = module
|
let module_style = module
|
||||||
.config_value_style("style")
|
.config_value_style("style")
|
||||||
.unwrap_or_else(|| Color::White.bold().dimmed());
|
.unwrap_or_else(|| Color::White.bold().dimmed());
|
||||||
|
@ -7,10 +7,6 @@ use super::{Context, Module};
|
|||||||
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||||
let mut module = context.new_module("time");
|
let mut module = context.new_module("time");
|
||||||
|
|
||||||
if module.config_value_bool("disabled").unwrap_or(true) {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let module_style = module
|
let module_style = module
|
||||||
.config_value_style("style")
|
.config_value_style("style")
|
||||||
.unwrap_or_else(|| Color::Yellow.bold());
|
.unwrap_or_else(|| Color::Yellow.bold());
|
||||||
|
@ -11,13 +11,8 @@ should not display when disabled, should display *something* when enabled,
|
|||||||
and should have the correct prefixes and suffixes in a given config */
|
and should have the correct prefixes and suffixes in a given config */
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn config_enabled() -> io::Result<()> {
|
fn config_default() -> io::Result<()> {
|
||||||
let output = common::render_module("time")
|
let output = common::render_module("time").output()?;
|
||||||
.use_config(toml::toml! {
|
|
||||||
[time]
|
|
||||||
disabled = false
|
|
||||||
})
|
|
||||||
.output()?;
|
|
||||||
let actual = String::from_utf8(output.stdout).unwrap();
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
// We can't test what it actually is...but we can assert it's not blank
|
// We can't test what it actually is...but we can assert it's not blank
|
||||||
@ -25,22 +20,11 @@ fn config_enabled() -> io::Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn config_blank() -> io::Result<()> {
|
|
||||||
let output = common::render_module("time").output()?;
|
|
||||||
let actual = String::from_utf8(output.stdout).unwrap();
|
|
||||||
|
|
||||||
let expected = "";
|
|
||||||
assert_eq!(expected, actual);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn config_check_prefix_and_suffix() -> io::Result<()> {
|
fn config_check_prefix_and_suffix() -> io::Result<()> {
|
||||||
let output = common::render_module("time")
|
let output = common::render_module("time")
|
||||||
.use_config(toml::toml! {
|
.use_config(toml::toml! {
|
||||||
[time]
|
[time]
|
||||||
disabled = false
|
|
||||||
format = "[%T]"
|
format = "[%T]"
|
||||||
})
|
})
|
||||||
.output()?;
|
.output()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user