mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
fix(directory): preserve substitution order (#1782)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use crate::configs::StarshipRootConfig;
|
||||
use crate::utils;
|
||||
use ansi_term::{Color, Style};
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use std::clone::Clone;
|
||||
use std::collections::HashMap;
|
||||
@@ -146,6 +147,22 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T, S: ::std::hash::BuildHasher + Default> ModuleConfig<'a> for IndexMap<String, T, S>
|
||||
where
|
||||
T: ModuleConfig<'a>,
|
||||
S: Clone,
|
||||
{
|
||||
fn from_config(config: &'a Value) -> Option<Self> {
|
||||
let mut im = IndexMap::default();
|
||||
|
||||
for (x, y) in config.as_table()?.iter() {
|
||||
im.insert(x.clone(), T::from_config(y)?);
|
||||
}
|
||||
|
||||
Some(im)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> ModuleConfig<'a> for Option<T>
|
||||
where
|
||||
T: ModuleConfig<'a> + Sized,
|
||||
|
||||
Reference in New Issue
Block a user