mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-25 17:57:19 +02:00
Add delete functionality
This commit is contained in:
parent
fb925e6182
commit
acd512ab7d
2 changed files with 21 additions and 0 deletions
20
src/app.rs
20
src/app.rs
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue