1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-26 03:27:30 +00:00

refactor: replace RootModuleConfig with Default (#2458)

This commit is contained in:
David Knaack 2021-03-15 11:40:52 +01:00 committed by GitHub
parent 6fd7d7b501
commit 052b56fe10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 174 additions and 175 deletions

View File

@ -14,18 +14,15 @@ use toml::Value;
/// Root config of a module. /// Root config of a module.
pub trait RootModuleConfig<'a> pub trait RootModuleConfig<'a>
where where
Self: ModuleConfig<'a>, Self: ModuleConfig<'a> + Default,
{ {
/// Create a new root module config with default values.
fn new() -> Self;
/// Load root module config from given Value and fill unset variables with default /// Load root module config from given Value and fill unset variables with default
/// values. /// values.
fn load(config: &'a Value) -> Self { fn load(config: &'a Value) -> Self {
if config.get("prompt_order").is_some() { if config.get("prompt_order").is_some() {
log::warn!("\"prompt_order\" has been removed in favor of \"format\". For more details, see: https://starship.rs/migrating-to-0.45.0/") log::warn!("\"prompt_order\" has been removed in favor of \"format\". For more details, see: https://starship.rs/migrating-to-0.45.0/")
} }
Self::new().load_config(config) Self::default().load_config(config)
} }
/// Helper function that will call RootModuleConfig::load(config) if config is Some, /// Helper function that will call RootModuleConfig::load(config) if config is Some,
@ -34,11 +31,13 @@ where
if let Some(config) = config { if let Some(config) = config {
Self::load(config) Self::load(config)
} else { } else {
Self::new() Self::default()
} }
} }
} }
impl<'a, T: ModuleConfig<'a> + Default> RootModuleConfig<'a> for T {}
/// Parsable config. /// Parsable config.
pub trait ModuleConfig<'a> pub trait ModuleConfig<'a>
where where
@ -346,7 +345,7 @@ impl StarshipConfig {
if let Some(root_config) = &self.config { if let Some(root_config) = &self.config {
StarshipRootConfig::load(root_config) StarshipRootConfig::load(root_config)
} else { } else {
StarshipRootConfig::new() StarshipRootConfig::default()
} }
} }
} }

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
use std::collections::HashMap; use std::collections::HashMap;
@ -11,8 +11,8 @@ pub struct AwsConfig<'a> {
pub region_aliases: HashMap<String, &'a str>, pub region_aliases: HashMap<String, &'a str>,
} }
impl<'a> RootModuleConfig<'a> for AwsConfig<'a> { impl<'a> Default for AwsConfig<'a> {
fn new() -> Self { fn default() -> Self {
AwsConfig { AwsConfig {
format: "on [$symbol($profile )(\\($region\\) )]($style)", format: "on [$symbol($profile )(\\($region\\) )]($style)",
symbol: "☁️ ", symbol: "☁️ ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -14,8 +14,8 @@ pub struct BatteryConfig<'a> {
pub format: &'a str, pub format: &'a str,
} }
impl<'a> RootModuleConfig<'a> for BatteryConfig<'a> { impl<'a> Default for BatteryConfig<'a> {
fn new() -> Self { fn default() -> Self {
BatteryConfig { BatteryConfig {
full_symbol: "", full_symbol: "",
charging_symbol: "", charging_symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -11,8 +11,8 @@ pub struct CharacterConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for CharacterConfig<'a> { impl<'a> Default for CharacterConfig<'a> {
fn new() -> Self { fn default() -> Self {
CharacterConfig { CharacterConfig {
format: "$symbol ", format: "$symbol ",
success_symbol: "[](bold green)", success_symbol: "[](bold green)",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct CMakeConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for CMakeConfig<'a> { impl<'a> Default for CMakeConfig<'a> {
fn new() -> Self { fn default() -> Self {
CMakeConfig { CMakeConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "", symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct CmdDurationConfig<'a> {
pub min_time_to_notify: i64, pub min_time_to_notify: i64,
} }
impl<'a> RootModuleConfig<'a> for CmdDurationConfig<'a> { impl<'a> Default for CmdDurationConfig<'a> {
fn new() -> Self { fn default() -> Self {
CmdDurationConfig { CmdDurationConfig {
min_time: 2_000, min_time: 2_000,
format: "took [$duration]($style) ", format: "took [$duration]($style) ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -12,8 +12,8 @@ pub struct CondaConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for CondaConfig<'a> { impl<'a> Default for CondaConfig<'a> {
fn new() -> Self { fn default() -> Self {
CondaConfig { CondaConfig {
truncation_length: 1, truncation_length: 1,
format: "via [$symbol$environment]($style) ", format: "via [$symbol$environment]($style) ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct CrystalConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for CrystalConfig<'a> { impl<'a> Default for CrystalConfig<'a> {
fn new() -> Self { fn default() -> Self {
CrystalConfig { CrystalConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "🔮 ", symbol: "🔮 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig, VecOr}; use crate::config::{ModuleConfig, VecOr};
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -26,8 +26,8 @@ pub struct CustomConfig<'a> {
pub directories: Directories<'a>, pub directories: Directories<'a>,
} }
impl<'a> RootModuleConfig<'a> for CustomConfig<'a> { impl<'a> Default for CustomConfig<'a> {
fn new() -> Self { fn default() -> Self {
CustomConfig { CustomConfig {
format: "[$symbol($output )]($style)", format: "[$symbol($output )]($style)",
symbol: "", symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct DartConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for DartConfig<'a> { impl<'a> Default for DartConfig<'a> {
fn new() -> Self { fn default() -> Self {
DartConfig { DartConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "🎯 ", symbol: "🎯 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use indexmap::IndexMap; use indexmap::IndexMap;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -19,8 +19,8 @@ pub struct DirectoryConfig<'a> {
pub home_symbol: &'a str, pub home_symbol: &'a str,
} }
impl<'a> RootModuleConfig<'a> for DirectoryConfig<'a> { impl<'a> Default for DirectoryConfig<'a> {
fn new() -> Self { fn default() -> Self {
DirectoryConfig { DirectoryConfig {
truncation_length: 3, truncation_length: 3,
truncate_to_repo: true, truncate_to_repo: true,

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -14,8 +14,8 @@ pub struct DockerContextConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for DockerContextConfig<'a> { impl<'a> Default for DockerContextConfig<'a> {
fn new() -> Self { fn default() -> Self {
DockerContextConfig { DockerContextConfig {
symbol: "🐳 ", symbol: "🐳 ",
style: "blue bold", style: "blue bold",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -14,8 +14,8 @@ pub struct DotnetConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for DotnetConfig<'a> { impl<'a> Default for DotnetConfig<'a> {
fn new() -> Self { fn default() -> Self {
DotnetConfig { DotnetConfig {
format: "[$symbol($version )(🎯 $tfm )]($style)", format: "[$symbol($version )(🎯 $tfm )]($style)",
symbol: "•NET ", symbol: "•NET ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct ElixirConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for ElixirConfig<'a> { impl<'a> Default for ElixirConfig<'a> {
fn new() -> Self { fn default() -> Self {
ElixirConfig { ElixirConfig {
format: "via [$symbol($version \\(OTP $otp_version\\) )]($style)", format: "via [$symbol($version \\(OTP $otp_version\\) )]($style)",
symbol: "💧 ", symbol: "💧 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct ElmConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for ElmConfig<'a> { impl<'a> Default for ElmConfig<'a> {
fn new() -> Self { fn default() -> Self {
ElmConfig { ElmConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "🌳 ", symbol: "🌳 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -12,8 +12,8 @@ pub struct EnvVarConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for EnvVarConfig<'a> { impl<'a> Default for EnvVarConfig<'a> {
fn new() -> Self { fn default() -> Self {
EnvVarConfig { EnvVarConfig {
symbol: "", symbol: "",
style: "black bold dimmed", style: "black bold dimmed",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct ErlangConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for ErlangConfig<'a> { impl<'a> Default for ErlangConfig<'a> {
fn new() -> Self { fn default() -> Self {
ErlangConfig { ErlangConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "", symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
use std::collections::HashMap; use std::collections::HashMap;
@ -11,8 +11,8 @@ pub struct GcloudConfig<'a> {
pub region_aliases: HashMap<String, &'a str>, pub region_aliases: HashMap<String, &'a str>,
} }
impl<'a> RootModuleConfig<'a> for GcloudConfig<'a> { impl<'a> Default for GcloudConfig<'a> {
fn new() -> Self { fn default() -> Self {
GcloudConfig { GcloudConfig {
format: "on [$symbol$account(\\($region\\))]($style) ", format: "on [$symbol$account(\\($region\\))]($style) ",
symbol: "☁️ ", symbol: "☁️ ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -14,8 +14,8 @@ pub struct GitBranchConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for GitBranchConfig<'a> { impl<'a> Default for GitBranchConfig<'a> {
fn new() -> Self { fn default() -> Self {
GitBranchConfig { GitBranchConfig {
format: "on [$symbol$branch]($style)(:[$remote]($style)) ", format: "on [$symbol$branch]($style)(:[$remote]($style)) ",
symbol: "", symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct GitCommitConfig<'a> {
pub tag_disabled: bool, pub tag_disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for GitCommitConfig<'a> { impl<'a> Default for GitCommitConfig<'a> {
fn new() -> Self { fn default() -> Self {
GitCommitConfig { GitCommitConfig {
// be consistent with git by default, which has DEFAULT_ABBREV set to 7 // be consistent with git by default, which has DEFAULT_ABBREV set to 7
commit_hash_length: 7, commit_hash_length: 7,

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -16,8 +16,8 @@ pub struct GitStateConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for GitStateConfig<'a> { impl<'a> Default for GitStateConfig<'a> {
fn new() -> Self { fn default() -> Self {
GitStateConfig { GitStateConfig {
rebase: "REBASING", rebase: "REBASING",
merge: "MERGING", merge: "MERGING",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -19,8 +19,8 @@ pub struct GitStatusConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for GitStatusConfig<'a> { impl<'a> Default for GitStatusConfig<'a> {
fn new() -> Self { fn default() -> Self {
GitStatusConfig { GitStatusConfig {
format: "([\\[$all_status$ahead_behind\\]]($style) )", format: "([\\[$all_status$ahead_behind\\]]($style) )",
style: "red bold", style: "red bold",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct GoConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for GoConfig<'a> { impl<'a> Default for GoConfig<'a> {
fn new() -> Self { fn default() -> Self {
GoConfig { GoConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "🐹 ", symbol: "🐹 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct HelmConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for HelmConfig<'a> { impl<'a> Default for HelmConfig<'a> {
fn new() -> Self { fn default() -> Self {
HelmConfig { HelmConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "", symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -12,8 +12,8 @@ pub struct HgBranchConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for HgBranchConfig<'a> { impl<'a> Default for HgBranchConfig<'a> {
fn new() -> Self { fn default() -> Self {
HgBranchConfig { HgBranchConfig {
symbol: "", symbol: "",
style: "bold purple", style: "bold purple",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -11,8 +11,8 @@ pub struct HostnameConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for HostnameConfig<'a> { impl<'a> Default for HostnameConfig<'a> {
fn new() -> Self { fn default() -> Self {
HostnameConfig { HostnameConfig {
ssh_only: true, ssh_only: true,
trim_at: ".", trim_at: ".",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct JavaConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for JavaConfig<'a> { impl<'a> Default for JavaConfig<'a> {
fn new() -> Self { fn default() -> Self {
JavaConfig { JavaConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
disabled: false, disabled: false,

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -11,8 +11,8 @@ pub struct JobsConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for JobsConfig<'a> { impl<'a> Default for JobsConfig<'a> {
fn new() -> Self { fn default() -> Self {
JobsConfig { JobsConfig {
threshold: 1, threshold: 1,
format: "[$symbol$number]($style) ", format: "[$symbol$number]($style) ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct JuliaConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for JuliaConfig<'a> { impl<'a> Default for JuliaConfig<'a> {
fn new() -> Self { fn default() -> Self {
JuliaConfig { JuliaConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "", symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -14,8 +14,8 @@ pub struct KotlinConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for KotlinConfig<'a> { impl<'a> Default for KotlinConfig<'a> {
fn new() -> Self { fn default() -> Self {
KotlinConfig { KotlinConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "🅺 ", symbol: "🅺 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
use std::collections::HashMap; use std::collections::HashMap;
@ -12,8 +12,8 @@ pub struct KubernetesConfig<'a> {
pub context_aliases: HashMap<String, &'a str>, pub context_aliases: HashMap<String, &'a str>,
} }
impl<'a> RootModuleConfig<'a> for KubernetesConfig<'a> { impl<'a> Default for KubernetesConfig<'a> {
fn new() -> Self { fn default() -> Self {
KubernetesConfig { KubernetesConfig {
symbol: "", symbol: "",
format: "[$symbol$context( \\($namespace\\))]($style) in ", format: "[$symbol$context( \\($namespace\\))]($style) in ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -14,8 +14,8 @@ pub struct LuaConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for LuaConfig<'a> { impl<'a> Default for LuaConfig<'a> {
fn new() -> Self { fn default() -> Self {
LuaConfig { LuaConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "🌙 ", symbol: "🌙 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -11,8 +11,8 @@ pub struct MemoryConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for MemoryConfig<'a> { impl<'a> Default for MemoryConfig<'a> {
fn new() -> Self { fn default() -> Self {
MemoryConfig { MemoryConfig {
threshold: 75, threshold: 75,
format: "via $symbol[$ram( | $swap)]($style) ", format: "via $symbol[$ram( | $swap)]($style) ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct NimConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for NimConfig<'a> { impl<'a> Default for NimConfig<'a> {
fn new() -> Self { fn default() -> Self {
NimConfig { NimConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "👑 ", symbol: "👑 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -15,8 +15,8 @@ pub struct NixShellConfig<'a> {
/* The trailing double spaces in `symbol` are needed to work around issues with /* The trailing double spaces in `symbol` are needed to work around issues with
multiwidth emoji support in some shells. Please do not file a PR to change this multiwidth emoji support in some shells. Please do not file a PR to change this
unless you can show that your changes do not affect this workaround. */ unless you can show that your changes do not affect this workaround. */
impl<'a> RootModuleConfig<'a> for NixShellConfig<'a> { impl<'a> Default for NixShellConfig<'a> {
fn new() -> Self { fn default() -> Self {
NixShellConfig { NixShellConfig {
format: "via [$symbol$state( \\($name\\))]($style) ", format: "via [$symbol$state( \\($name\\))]($style) ",
symbol: "❄️ ", symbol: "❄️ ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -14,8 +14,8 @@ pub struct NodejsConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for NodejsConfig<'a> { impl<'a> Default for NodejsConfig<'a> {
fn new() -> Self { fn default() -> Self {
NodejsConfig { NodejsConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "", symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct OCamlConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for OCamlConfig<'a> { impl<'a> Default for OCamlConfig<'a> {
fn new() -> Self { fn default() -> Self {
OCamlConfig { OCamlConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "🐫 ", symbol: "🐫 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
#[derive(Clone, ModuleConfig)] #[derive(Clone, ModuleConfig)]
@ -9,8 +9,8 @@ pub struct OspConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for OspConfig<'a> { impl<'a> Default for OspConfig<'a> {
fn new() -> Self { fn default() -> Self {
OspConfig { OspConfig {
format: "on [$symbol$cloud(\\($project\\))]($style) ", format: "on [$symbol$cloud(\\($project\\))]($style) ",
symbol: "☁️ ", symbol: "☁️ ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -11,8 +11,8 @@ pub struct PackageConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for PackageConfig<'a> { impl<'a> Default for PackageConfig<'a> {
fn new() -> Self { fn default() -> Self {
PackageConfig { PackageConfig {
format: "is [$symbol$version]($style) ", format: "is [$symbol$version]($style) ",
symbol: "📦 ", symbol: "📦 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct PerlConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for PerlConfig<'a> { impl<'a> Default for PerlConfig<'a> {
fn new() -> Self { fn default() -> Self {
PerlConfig { PerlConfig {
symbol: "🐪 ", symbol: "🐪 ",
style: "149 bold", style: "149 bold",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct PhpConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for PhpConfig<'a> { impl<'a> Default for PhpConfig<'a> {
fn new() -> Self { fn default() -> Self {
PhpConfig { PhpConfig {
symbol: "🐘 ", symbol: "🐘 ",
style: "147 bold", style: "147 bold",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct PureScriptConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for PureScriptConfig<'a> { impl<'a> Default for PureScriptConfig<'a> {
fn new() -> Self { fn default() -> Self {
PureScriptConfig { PureScriptConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "<=> ", symbol: "<=> ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig, VecOr}; use crate::config::{ModuleConfig, VecOr};
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -16,8 +16,8 @@ pub struct PythonConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for PythonConfig<'a> { impl<'a> Default for PythonConfig<'a> {
fn new() -> Self { fn default() -> Self {
PythonConfig { PythonConfig {
pyenv_version_name: false, pyenv_version_name: false,
pyenv_prefix: "pyenv ", pyenv_prefix: "pyenv ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct RubyConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for RubyConfig<'a> { impl<'a> Default for RubyConfig<'a> {
fn new() -> Self { fn default() -> Self {
RubyConfig { RubyConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "💎 ", symbol: "💎 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct RustConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for RustConfig<'a> { impl<'a> Default for RustConfig<'a> {
fn new() -> Self { fn default() -> Self {
RustConfig { RustConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "🦀 ", symbol: "🦀 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct ScalaConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for ScalaConfig<'a> { impl<'a> Default for ScalaConfig<'a> {
fn new() -> Self { fn default() -> Self {
ScalaConfig { ScalaConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
disabled: false, disabled: false,

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -15,8 +15,8 @@ pub struct ShellConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for ShellConfig<'a> { impl<'a> Default for ShellConfig<'a> {
fn new() -> Self { fn default() -> Self {
ShellConfig { ShellConfig {
format: "$indicator ", format: "$indicator ",
bash_indicator: "bsh", bash_indicator: "bsh",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -12,8 +12,8 @@ pub struct ShLvlConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for ShLvlConfig<'a> { impl<'a> Default for ShLvlConfig<'a> {
fn new() -> Self { fn default() -> Self {
ShLvlConfig { ShLvlConfig {
threshold: 2, threshold: 2,
format: "[$symbol$shlvl]($style) ", format: "[$symbol$shlvl]($style) ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -10,8 +10,8 @@ pub struct SingularityConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for SingularityConfig<'a> { impl<'a> Default for SingularityConfig<'a> {
fn new() -> Self { fn default() -> Self {
SingularityConfig { SingularityConfig {
format: "[$symbol\\[$env\\]]($style) ", format: "[$symbol\\[$env\\]]($style) ",
symbol: "", symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -76,8 +76,8 @@ pub const PROMPT_ORDER: &[&str] = &[
"character", "character",
]; ];
impl<'a> RootModuleConfig<'a> for StarshipRootConfig<'a> { impl<'a> Default for StarshipRootConfig<'a> {
fn new() -> Self { fn default() -> Self {
StarshipRootConfig { StarshipRootConfig {
format: "$all", format: "$all",
scan_timeout: 30, scan_timeout: 30,

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -16,8 +16,8 @@ pub struct StatusConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for StatusConfig<'a> { impl<'a> Default for StatusConfig<'a> {
fn new() -> Self { fn default() -> Self {
StatusConfig { StatusConfig {
format: "[$symbol$status]($style) ", format: "[$symbol$status]($style) ",
symbol: "", symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct SwiftConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for SwiftConfig<'a> { impl<'a> Default for SwiftConfig<'a> {
fn new() -> Self { fn default() -> Self {
SwiftConfig { SwiftConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "🐦 ", symbol: "🐦 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct TerraformConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for TerraformConfig<'a> { impl<'a> Default for TerraformConfig<'a> {
fn new() -> Self { fn default() -> Self {
TerraformConfig { TerraformConfig {
format: "via [$symbol$workspace]($style) ", format: "via [$symbol$workspace]($style) ",
symbol: "💠 ", symbol: "💠 ",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct TimeConfig<'a> {
pub time_range: &'a str, pub time_range: &'a str,
} }
impl<'a> RootModuleConfig<'a> for TimeConfig<'a> { impl<'a> Default for TimeConfig<'a> {
fn new() -> Self { fn default() -> Self {
TimeConfig { TimeConfig {
format: "at [$time]($style) ", format: "at [$time]($style) ",
style: "bold yellow", style: "bold yellow",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -11,8 +11,8 @@ pub struct UsernameConfig<'a> {
pub disabled: bool, pub disabled: bool,
} }
impl<'a> RootModuleConfig<'a> for UsernameConfig<'a> { impl<'a> Default for UsernameConfig<'a> {
fn new() -> Self { fn default() -> Self {
UsernameConfig { UsernameConfig {
format: "[$user]($style) in ", format: "[$user]($style) in ",
style_root: "red bold", style_root: "red bold",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct VagrantConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for VagrantConfig<'a> { impl<'a> Default for VagrantConfig<'a> {
fn new() -> Self { fn default() -> Self {
VagrantConfig { VagrantConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "", symbol: "",

View File

@ -1,4 +1,4 @@
use crate::config::{ModuleConfig, RootModuleConfig}; use crate::config::ModuleConfig;
use starship_module_config_derive::ModuleConfig; use starship_module_config_derive::ModuleConfig;
@ -13,8 +13,8 @@ pub struct ZigConfig<'a> {
pub detect_folders: Vec<&'a str>, pub detect_folders: Vec<&'a str>,
} }
impl<'a> RootModuleConfig<'a> for ZigConfig<'a> { impl<'a> Default for ZigConfig<'a> {
fn new() -> Self { fn default() -> Self {
ZigConfig { ZigConfig {
format: "via [$symbol($version )]($style)", format: "via [$symbol($version )]($style)",
symbol: "", symbol: "",