mirror of
https://github.com/nivekuil/rip
synced 2024-11-25 21:20:18 +00:00
Simplify resurrect a bit
This commit is contained in:
parent
52163d50ae
commit
78b26fbeb0
1 changed files with 5 additions and 7 deletions
12
src/main.rs
12
src/main.rs
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue