Add delete functionality

This commit is contained in:
Dheepak Krishnamurthy 2020-07-28 13:58:03 -06:00
parent fb925e6182
commit acd512ab7d
2 changed files with 21 additions and 0 deletions

View file

@ -482,6 +482,26 @@ impl App {
);
}
pub fn task_delete(&self) {
if self.tasks.len() == 0 {
return
}
let selected = self.state.selected().unwrap_or_default();
let task_id = self.tasks[selected].id().unwrap_or_default();
let output = Command::new("task")
.arg("rc.confirmation=off")
.arg("delete")
.arg(format!("{}", task_id))
.output()
.expect(
&format!(
"Cannot run `task delete` for task `{}`. Check documentation for more information",
task_id
)[..],
);
}
pub fn task_done(&mut self) {
if self.tasks.len() == 0 {
return