mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-26 03:07:18 +02:00
fix: Show error only once
This commit is contained in:
parent
d0f3a05de7
commit
3747aa820d
1 changed files with 11 additions and 3 deletions
|
@ -191,6 +191,7 @@ pub struct TaskwarriorTui {
|
||||||
pub projects: ProjectsState,
|
pub projects: ProjectsState,
|
||||||
pub contexts: ContextsState,
|
pub contexts: ContextsState,
|
||||||
pub task_version: Versioning,
|
pub task_version: Versioning,
|
||||||
|
pub can_update: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TaskwarriorTui {
|
impl TaskwarriorTui {
|
||||||
|
@ -266,6 +267,7 @@ impl TaskwarriorTui {
|
||||||
projects: ProjectsState::new(),
|
projects: ProjectsState::new(),
|
||||||
contexts: ContextsState::new(),
|
contexts: ContextsState::new(),
|
||||||
task_version,
|
task_version,
|
||||||
|
can_update: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
for c in app.config.filter.chars() {
|
for c in app.config.filter.chars() {
|
||||||
|
@ -1614,9 +1616,13 @@ impl TaskwarriorTui {
|
||||||
if let Ok(imported) = import(data.as_bytes()) {
|
if let Ok(imported) = import(data.as_bytes()) {
|
||||||
self.tasks = imported;
|
self.tasks = imported;
|
||||||
}
|
}
|
||||||
|
self.can_update = true;
|
||||||
} else {
|
} else {
|
||||||
|
if self.can_update {
|
||||||
self.mode = Mode::Tasks(Action::Error);
|
self.mode = Mode::Tasks(Action::Error);
|
||||||
self.error = format!("Running `{:?}` failed ({}): {}", &task, output.status, error);
|
self.error = format!("Running `{:?}` failed ({}): {}", &task, output.status, error);
|
||||||
|
self.can_update = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -3055,9 +3061,11 @@ impl TaskwarriorTui {
|
||||||
self.mode = Mode::Tasks(Action::Report);
|
self.mode = Mode::Tasks(Action::Report);
|
||||||
self.filter_history.add(self.filter.as_str());
|
self.filter_history.add(self.filter.as_str());
|
||||||
// self.history_status = None;
|
// self.history_status = None;
|
||||||
|
if self.can_update {
|
||||||
self.update(true)?;
|
self.update(true)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Key::Char('\n') => {
|
Key::Char('\n') => {
|
||||||
if self.show_completion_pane {
|
if self.show_completion_pane {
|
||||||
self.show_completion_pane = false;
|
self.show_completion_pane = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue