dependency tracking; code cleanup; removed option to discard; move to

trash rather than delete
This commit is contained in:
aaron-jack-manning
2022-08-25 16:40:56 +10:00
parent bc602c4d34
commit 170dbdcc2c
12 changed files with 287 additions and 110 deletions

View File

@@ -3,6 +3,7 @@ use crate::error;
use crate::colour;
use crate::tasks::Id;
use std::fmt::Write;
use std::collections::HashMap;
use serde_with::{serde_as, DisplayFromStr};
@@ -67,14 +68,14 @@ impl Index {
}
else {
let coloured_ids : Vec<_> =
ids.into_iter()
.map(|i| colour::id(&i.to_string()))
ids.iter()
.map(|i| colour::id(*i))
.collect();
let mut display_ids = String::new();
for id in coloured_ids {
display_ids.push_str(&format!("{}, ", id));
write!(&mut display_ids, "{}, ", id).unwrap();
}
if !display_ids.is_empty() {
@@ -85,10 +86,9 @@ impl Index {
Err(error::Error::Generic(format!("Multiple notes (Ids: [{}]) by that name exist", display_ids)))
}
},
None => Err(error::Error::Generic(format!("A note by the name {} does not exist", colour::task_name(&name)))),
None => Err(error::Error::Generic(format!("A note by the name {} does not exist", colour::task_name(name)))),
}
}
}
}
}