mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-24 23:46:41 +02:00
Merge pull request #128 from kdheepak/fix-context-menu
Update context menu
This commit is contained in:
commit
d7d5cb31e7
1 changed files with 15 additions and 4 deletions
19
src/app.rs
19
src/app.rs
|
@ -793,9 +793,12 @@ impl TTApp {
|
|||
self.context_table_state.select(Some(i));
|
||||
}
|
||||
|
||||
pub fn context_select(&mut self) {
|
||||
pub fn context_select(&mut self) -> Result<(), String> {
|
||||
let i = self.context_table_state.selected().unwrap();
|
||||
let output = Command::new("task").arg("context").arg(&self.contexts[i].name).output();
|
||||
let mut command = Command::new("task");
|
||||
command.arg("context").arg(&self.contexts[i].name);
|
||||
let output = command.output();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn task_report_top(&mut self) {
|
||||
|
@ -1561,8 +1564,16 @@ impl TTApp {
|
|||
} else if input == Key::Up || input == self.keyconfig.up {
|
||||
self.context_previous();
|
||||
} else if input == Key::Char('\n') {
|
||||
self.context_select();
|
||||
self.get_context()?;
|
||||
match self.context_select() {
|
||||
Ok(_) => {
|
||||
self.get_context()?;
|
||||
self.update(true)?;
|
||||
}
|
||||
Err(e) => {
|
||||
self.mode = AppMode::TaskError;
|
||||
self.error = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AppMode::TaskHelpPopup => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue