in src/mapping.rs [221:249]
fn get_mappings(
vars: &HashMap<String, String>,
sources: &Option<Vec<&str>>,
destinations: &Option<Vec<&str>>,
out: &mut Vec<PathMappingGenerator>,
) -> common::Result<()> {
if sources.is_none() && destinations.is_none() {
return Ok(());
}
anyhow::ensure!(
sources.as_ref().map_or(0, |v| v.len()) == destinations.as_ref().map_or(0, |v| v.len()),
"mapping-src and mapping-dest must have the same number of elements"
);
let sources = sources.as_ref().unwrap();
let destinations = destinations.as_ref().unwrap();
for (src, dest) in sources.iter().zip(destinations.iter()) {
out.push(PathMappingGenerator::new(
src,
dest,
vars,
HashSet::default(),
)?);
}
Ok(())
}