mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-28 07:46:28 +00:00
fix(print-config): fix battery module and add missing modules (#2930)
* fix(print-config): fix battery and vcsh module handling * sort, add test, add line_break module
This commit is contained in:
parent
dc1c974287
commit
b0853876ea
15
src/configs/line_break.rs
Normal file
15
src/configs/line_break.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use crate::config::ModuleConfig;
|
||||
|
||||
use serde::Serialize;
|
||||
use starship_module_config_derive::ModuleConfig;
|
||||
|
||||
#[derive(Clone, ModuleConfig, Serialize)]
|
||||
pub struct LineBreakConfig {
|
||||
pub disabled: bool,
|
||||
}
|
||||
|
||||
impl<'a> Default for LineBreakConfig {
|
||||
fn default() -> Self {
|
||||
LineBreakConfig { disabled: false }
|
||||
}
|
||||
}
|
@ -35,6 +35,7 @@ pub mod jobs;
|
||||
pub mod julia;
|
||||
pub mod kotlin;
|
||||
pub mod kubernetes;
|
||||
pub mod line_break;
|
||||
pub mod lua;
|
||||
pub mod memory_usage;
|
||||
pub mod nim;
|
||||
@ -78,7 +79,7 @@ pub struct FullConfig<'a> {
|
||||
pub add_newline: bool,
|
||||
// modules
|
||||
aws: aws::AwsConfig<'a>,
|
||||
battery: battery::BatteryDisplayConfig<'a>,
|
||||
battery: battery::BatteryConfig<'a>,
|
||||
character: character::CharacterConfig<'a>,
|
||||
cmake: cmake::CMakeConfig<'a>,
|
||||
cmd_duration: cmd_duration::CmdDurationConfig<'a>,
|
||||
@ -108,6 +109,7 @@ pub struct FullConfig<'a> {
|
||||
julia: julia::JuliaConfig<'a>,
|
||||
kotlin: kotlin::KotlinConfig<'a>,
|
||||
kubernetes: kubernetes::KubernetesConfig<'a>,
|
||||
line_break: line_break::LineBreakConfig,
|
||||
lua: lua::LuaConfig<'a>,
|
||||
memory_usage: memory_usage::MemoryConfig<'a>,
|
||||
nim: nim::NimConfig<'a>,
|
||||
@ -120,8 +122,8 @@ pub struct FullConfig<'a> {
|
||||
php: php::PhpConfig<'a>,
|
||||
purescript: purescript::PureScriptConfig<'a>,
|
||||
python: python::PythonConfig<'a>,
|
||||
rlang: rlang::RLangConfig<'a>,
|
||||
red: red::RedConfig<'a>,
|
||||
rlang: rlang::RLangConfig<'a>,
|
||||
ruby: ruby::RubyConfig<'a>,
|
||||
rust: rust::RustConfig<'a>,
|
||||
scala: scala::ScalaConfig<'a>,
|
||||
@ -133,8 +135,9 @@ pub struct FullConfig<'a> {
|
||||
terraform: terraform::TerraformConfig<'a>,
|
||||
time: time::TimeConfig<'a>,
|
||||
username: username::UsernameConfig<'a>,
|
||||
vlang: v::VConfig<'a>,
|
||||
vagrant: vagrant::VagrantConfig<'a>,
|
||||
vcsh: vcsh::VcshConfig<'a>,
|
||||
vlang: v::VConfig<'a>,
|
||||
zig: zig::ZigConfig<'a>,
|
||||
custom: IndexMap<String, custom::CustomConfig<'a>>,
|
||||
}
|
||||
@ -178,6 +181,7 @@ impl<'a> Default for FullConfig<'a> {
|
||||
julia: Default::default(),
|
||||
kotlin: Default::default(),
|
||||
kubernetes: Default::default(),
|
||||
line_break: Default::default(),
|
||||
lua: Default::default(),
|
||||
memory_usage: Default::default(),
|
||||
nim: Default::default(),
|
||||
@ -204,9 +208,26 @@ impl<'a> Default for FullConfig<'a> {
|
||||
time: Default::default(),
|
||||
username: Default::default(),
|
||||
vagrant: Default::default(),
|
||||
vcsh: Default::default(),
|
||||
vlang: Default::default(),
|
||||
zig: Default::default(),
|
||||
custom: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::module::ALL_MODULES;
|
||||
use toml::value::Value;
|
||||
|
||||
#[test]
|
||||
fn test_all_modules_in_full_config() {
|
||||
let full_cfg = Value::try_from(FullConfig::default()).unwrap();
|
||||
let cfg_table = full_cfg.as_table().unwrap();
|
||||
for module in ALL_MODULES {
|
||||
assert!(cfg_table.contains_key(*module));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
use crate::config::ModuleConfig;
|
||||
|
||||
use serde::Serialize;
|
||||
use starship_module_config_derive::ModuleConfig;
|
||||
|
||||
#[derive(Clone, ModuleConfig)]
|
||||
#[derive(Clone, ModuleConfig, Serialize)]
|
||||
pub struct VcshConfig<'a> {
|
||||
pub symbol: &'a str,
|
||||
pub style: &'a str,
|
||||
|
Loading…
Reference in New Issue
Block a user