mirror of
https://github.com/nivekuil/rip
synced 2025-02-18 04:58:25 +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);
|
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.
|
// Vector to hold the grave path of items we want to resurrect.
|
||||||
// This will be used to determine which items to remove from the
|
// This will be used to determine which items to remove from the
|
||||||
// record following the resurrect.
|
// 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
|
// If -s is also passed, push all files found by seance onto
|
||||||
// the graves_to_exhume.
|
// the graves_to_exhume.
|
||||||
if matches.is_present("seance") {
|
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
|
// Otherwise, add the last deleted file
|
||||||
if graves_to_exhume.is_empty() {
|
if graves_to_exhume.is_empty() {
|
||||||
if let Ok(s) = get_last_bury(record) {
|
if let Ok(s) = get_last_bury(record) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue