mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
fix: only print root level config logs a single time (#3132)
This commit is contained in:
+6
-9
@@ -1,4 +1,3 @@
|
||||
use crate::configs::StarshipRootConfig;
|
||||
use crate::utils;
|
||||
use ansi_term::{Color, Style};
|
||||
use indexmap::IndexMap;
|
||||
@@ -63,6 +62,12 @@ impl<'a> ModuleConfig<'a> for &'a str {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ModuleConfig<'a> for String {
|
||||
fn from_config(config: &'a Value) -> Option<Self> {
|
||||
config.as_str().map(std::borrow::ToOwned::to_owned)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ModuleConfig<'a> for Style {
|
||||
fn from_config(config: &Value) -> Option<Self> {
|
||||
parse_style_string(config.as_str()?)
|
||||
@@ -346,14 +351,6 @@ impl StarshipConfig {
|
||||
pub fn get_env_var_modules(&self) -> Option<&toml::value::Table> {
|
||||
self.get_config(&["env_var"])?.as_table()
|
||||
}
|
||||
|
||||
pub fn get_root_config(&self) -> StarshipRootConfig {
|
||||
if let Some(root_config) = &self.config {
|
||||
StarshipRootConfig::load(root_config)
|
||||
} else {
|
||||
StarshipRootConfig::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Parse a style string which represents an ansi style. Valid tokens in the style
|
||||
|
||||
Reference in New Issue
Block a user