mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-25 17:57:19 +02:00
Use master of task-hookrs
This commit is contained in:
parent
953ec46e74
commit
48ddf56fe3
3 changed files with 78 additions and 216 deletions
30
src/app.rs
30
src/app.rs
|
@ -155,11 +155,29 @@ impl TTApp {
|
|||
.expect("Unable to run `task export`. Check documentation for more information.");
|
||||
let data = String::from_utf8(output.stdout).unwrap();
|
||||
let imported = import(data.as_bytes());
|
||||
if let Ok(i) = imported {
|
||||
*(tasks.lock().unwrap()) = i;
|
||||
tasks.lock().unwrap().sort_by(cmp);
|
||||
{
|
||||
if let Ok(i) = imported {
|
||||
*(tasks.lock().unwrap()) = i;
|
||||
tasks.lock().unwrap().sort_by(cmp);
|
||||
}
|
||||
let tasks_len = tasks.lock().unwrap().len();
|
||||
for i in 0..tasks_len {
|
||||
let task_id = tasks.lock().unwrap()[i].id().unwrap();
|
||||
let tags = TTApp::task_virtual_tags(task_id).unwrap();
|
||||
let task = &mut tasks.lock().unwrap()[i];
|
||||
match task.tags_mut() {
|
||||
Some(t) => {
|
||||
for tag in tags.split(" ") {
|
||||
t.push(tag.to_string())
|
||||
}
|
||||
},
|
||||
None => {
|
||||
task.set_tags(Some(tags.split(" ")))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
thread::sleep(Duration::from_millis(250));
|
||||
thread::sleep(Duration::from_millis(1000));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -713,7 +731,7 @@ impl TTApp {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn task_virtual_tags(&self, task_id: u64) -> Result<String, String> {
|
||||
pub fn task_virtual_tags(task_id: u64) -> Result<String, String> {
|
||||
let output = Command::new("task").arg(format!("{}", task_id)).output();
|
||||
|
||||
match output {
|
||||
|
@ -745,7 +763,7 @@ impl TTApp {
|
|||
let selected = self.state.selected().unwrap_or_default();
|
||||
let task_id = self.tasks.lock().unwrap()[selected].id().unwrap_or_default();
|
||||
let mut command = "start";
|
||||
for tag in self.task_virtual_tags(task_id)?.split(' ') {
|
||||
for tag in TTApp::task_virtual_tags(task_id)?.split(' ') {
|
||||
if tag == "ACTIVE" {
|
||||
command = "stop"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue