Simplify resurrect a bit

This commit is contained in:
Kevin Liu 2016-10-22 19:25:12 -07:00
parent 52163d50ae
commit 78b26fbeb0

View file

@ -89,11 +89,14 @@ Send files to the graveyard (/tmp/.graveyard) instead of unlinking them.")
libc::umask(0);
}
if let Some(s) = matches.values_of("resurrect") {
if let Some(res_targets) = matches.values_of("resurrect") {
// Vector to hold the grave path of items we want to resurrect.
// This will be used to determine which items to remove from the
// record following the resurrect.
let mut graves_to_exhume: Vec<String> = Vec::new();
// Initialize it with the arguments passed to -r
let mut graves_to_exhume: Vec<String> = res_targets
.map(|x| x.to_string()).collect();
// If -s is also passed, push all files found by seance onto
// the graves_to_exhume.
if matches.is_present("seance") {
@ -110,11 +113,6 @@ Send files to the graveyard (/tmp/.graveyard) instead of unlinking them.")
}
}
// Add any arguments passed to --resurrect
for grave in s {
graves_to_exhume.push(grave.to_string());
}
// Otherwise, add the last deleted file
if graves_to_exhume.is_empty() {
if let Ok(s) = get_last_bury(record) {