Add --keep display equivalent to --strip safe

This commit is contained in:
Andrew 2023-11-27 19:43:08 +13:00
parent f9db89342a
commit 16b04cd688

View file

@ -614,10 +614,20 @@ fn parse_opts_into_struct(
} }
if let Some(keep) = matches.get_one::<String>("keep") { if let Some(keep) = matches.get_one::<String>("keep") {
let names = keep let mut keep_display = false;
let mut names = keep
.split(',') .split(',')
.map(parse_chunk_name) .filter_map(|x| {
.collect::<Result<_, _>>()?; if x == "display" {
keep_display = true;
return None;
}
Some(parse_chunk_name(x))
})
.collect::<Result<IndexSet<_>, _>>()?;
if keep_display {
names.extend(StripChunks::KEEP_SAFE.iter().cloned());
}
opts.strip = StripChunks::Keep(names) opts.strip = StripChunks::Keep(names)
} }