mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-25 17:57:19 +02:00
Add log functionality
This commit is contained in:
parent
acd512ab7d
commit
2e32659d22
2 changed files with 45 additions and 0 deletions
25
src/app.rs
25
src/app.rs
|
@ -90,6 +90,7 @@ pub enum AppMode {
|
|||
Report,
|
||||
Filter,
|
||||
AddTask,
|
||||
LogTask,
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
|
@ -145,6 +146,16 @@ impl App {
|
|||
);
|
||||
self.draw_command(f, rects[2], &self.filter[..], "Filter");
|
||||
},
|
||||
AppMode::LogTask => {
|
||||
f.set_cursor(
|
||||
// Put cursor past the end of the input text
|
||||
rects[2].x + self.command.width() as u16 + 1,
|
||||
// Move one line down, from the border to the input line
|
||||
rects[2].y + 1,
|
||||
);
|
||||
f.render_widget(Clear, rects[2]);
|
||||
self.draw_command(f, rects[2], &self.command[..], "Log Task");
|
||||
},
|
||||
AppMode::AddTask => {
|
||||
f.set_cursor(
|
||||
// Put cursor past the end of the input text
|
||||
|
@ -420,6 +431,20 @@ impl App {
|
|||
self.update();
|
||||
}
|
||||
|
||||
pub fn task_log(&mut self) {
|
||||
if self.tasks.len() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
let output = Command::new("task")
|
||||
.arg("log")
|
||||
.arg(format!("{}", self.command))
|
||||
.output()
|
||||
.expect("Cannot run `task log`. Check documentation for more information");
|
||||
|
||||
self.command = "".to_string();
|
||||
}
|
||||
|
||||
pub fn task_add(&mut self) {
|
||||
if self.tasks.len() == 0 {
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue