Add --keep display equivalent to --strip safe
This commit is contained in:
parent
f9db89342a
commit
16b04cd688
1 changed files with 13 additions and 3 deletions
16
src/main.rs
16
src/main.rs
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue