update
This commit is contained in:
parent
4c7c5d88fa
commit
870ec706b3
4 changed files with 30 additions and 4 deletions
|
@ -15,21 +15,30 @@ fn print_task_oneline(task: &Task, api: &VikunjaAPI) {
|
|||
);
|
||||
}
|
||||
|
||||
pub fn print_current_tasks(api: &VikunjaAPI, done: bool, fav: bool) {
|
||||
pub fn print_current_tasks(api: &VikunjaAPI, done: bool, fav: bool, project: Option<&String>) {
|
||||
let current_tasks = api.get_all_tasks();
|
||||
|
||||
let selection: Vec<_> = if done {
|
||||
let mut selection: Vec<_> = if done {
|
||||
current_tasks
|
||||
} else {
|
||||
current_tasks.into_iter().filter(|x| !x.done).collect()
|
||||
};
|
||||
|
||||
let selection = if fav {
|
||||
selection = if fav {
|
||||
selection.into_iter().filter(|x| x.is_favorite).collect()
|
||||
} else {
|
||||
selection
|
||||
};
|
||||
|
||||
if let Some(project) = project {
|
||||
let p_id = api.parse_project_id(project).unwrap();
|
||||
|
||||
selection = selection
|
||||
.into_iter()
|
||||
.filter(|x| x.project_id == p_id)
|
||||
.collect();
|
||||
}
|
||||
|
||||
for task in selection {
|
||||
print_task_oneline(&task, api);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue