diff options
Diffstat (limited to 'src/config/mod.rs')
| -rw-r--r-- | src/config/mod.rs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 0ed22a2..87f53ba 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -2150,11 +2150,25 @@ pub(crate) fn merged( matches: &ArgMatches, options: &'static [OptionSpec], ) -> Result<(Layer, Vec<PathBuf>)> { - let files: Vec<PathBuf> = matches - .get_many::<String>(CONFIG) - .into_iter() - .flatten() - .map(PathBuf::from) + merged_with(matches, options, &[]) +} + +/// As `merged`, the files `first` read before those `matches` names, which win over them. +pub(crate) fn merged_with( + matches: &ArgMatches, + options: &'static [OptionSpec], + first: &[PathBuf], +) -> Result<(Layer, Vec<PathBuf>)> { + let files: Vec<PathBuf> = first + .iter() + .cloned() + .chain( + matches + .get_many::<String>(CONFIG) + .into_iter() + .flatten() + .map(PathBuf::from), + ) .collect(); let mut merged = Layer::new(); for path in &files { |
