summaryrefslogtreecommitdiffstats
path: root/src/commands/show_tasks.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/show_tasks.rs')
-rw-r--r--src/commands/show_tasks.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/commands/show_tasks.rs b/src/commands/show_tasks.rs
new file mode 100644
index 0000000..a1acd23
--- /dev/null
+++ b/src/commands/show_tasks.rs
@@ -0,0 +1,55 @@
+use crate::config::AppKeyMapping;
+use crate::context::AppContext;
+use crate::error::JoshutoResult;
+use crate::event::process_event;
+use crate::event::AppEvent;
+use crate::key_command::{Command, CommandKeybind};
+use crate::ui::views::TuiWorkerView;
+use crate::ui::TuiBackend;
+use crate::util::to_string::ToString;
+
+pub fn show_tasks(
+ context: &mut AppContext,
+ backend: &mut TuiBackend,
+ keymap_t: &AppKeyMapping,
+) -> JoshutoResult {
+ context.flush_event();
+
+ loop {
+ backend.render(TuiWorkerView::new(context));
+
+ if let Ok(event) = context.poll_event() {
+ match event {
+ AppEvent::Termion(key) => {
+ match key {
+ key => match keymap_t.task_view.get(&key) {
+ None => {
+ context
+ .message_queue_mut()
+ .push_info(format!("Unmapped input: {}", key.to_string()));
+ }
+ Some(CommandKeybind::SimpleKeybind(command)) => match command {
+ Command::ShowTasks => break,
+ _ => {}
+ },
+ Some(CommandKeybind::CompositeKeybind(m)) => {
+ let cmd =
+ process_event::get_input_while_composite(backend, context, &m);
+
+ if let Some(command) = cmd {
+ match command {
+ Command::ShowTasks => break,
+ _ => {}
+ }
+ }
+ }
+ },
+ }
+ context.flush_event();
+ }
+ event => process_event::process_noninteractive(event, context),
+ };
+ }
+ }
+ Ok(())
+}