mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-24 23:46:41 +02:00
refactor: Move action to own mod 📦
This commit is contained in:
parent
0c749b0f5c
commit
f83a21dd95
7 changed files with 39 additions and 35 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1401,7 +1401,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "taskwarrior-tui"
|
||||
version = "0.14.6"
|
||||
version = "0.14.7"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-std",
|
||||
|
|
16
src/action.rs
Normal file
16
src/action.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
#[derive(PartialEq, Debug)]
|
||||
pub enum Action {
|
||||
Report,
|
||||
Filter,
|
||||
Add,
|
||||
Annotate,
|
||||
Subprocess,
|
||||
Log,
|
||||
Modify,
|
||||
HelpPopup,
|
||||
Error,
|
||||
ContextMenu,
|
||||
Jump,
|
||||
DeletePrompt,
|
||||
DonePrompt,
|
||||
}
|
18
src/app.rs
18
src/app.rs
|
@ -68,7 +68,7 @@ use regex::Regex;
|
|||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use crate::app::Action::Report;
|
||||
use crate::action::Action;
|
||||
use crate::pane::context::{ContextDetails, ContextsState};
|
||||
use crate::pane::project::ProjectsState;
|
||||
use crate::pane::Pane;
|
||||
|
@ -152,22 +152,6 @@ pub enum Mode {
|
|||
Projects,
|
||||
Calendar,
|
||||
}
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum Action {
|
||||
Report,
|
||||
Filter,
|
||||
Add,
|
||||
Annotate,
|
||||
Subprocess,
|
||||
Log,
|
||||
Modify,
|
||||
HelpPopup,
|
||||
Error,
|
||||
ContextMenu,
|
||||
Jump,
|
||||
DeletePrompt,
|
||||
DonePrompt,
|
||||
}
|
||||
|
||||
pub struct TaskwarriorTui {
|
||||
pub should_quit: bool,
|
||||
|
|
29
src/main.rs
29
src/main.rs
|
@ -2,6 +2,20 @@
|
|||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
mod action;
|
||||
mod app;
|
||||
mod calendar;
|
||||
mod cli;
|
||||
mod completion;
|
||||
mod config;
|
||||
mod event;
|
||||
mod help;
|
||||
mod history;
|
||||
mod keyconfig;
|
||||
mod pane;
|
||||
mod table;
|
||||
mod task_report;
|
||||
|
||||
use std::env;
|
||||
use std::error::Error;
|
||||
use std::io::{self, Write};
|
||||
|
@ -23,23 +37,10 @@ use tui::{backend::CrosstermBackend, Terminal};
|
|||
|
||||
use app::{Mode, TaskwarriorTui};
|
||||
|
||||
use crate::app::Action;
|
||||
use crate::action::Action;
|
||||
use crate::event::{Event, EventConfig, Events, Key};
|
||||
use crate::keyconfig::KeyConfig;
|
||||
|
||||
mod app;
|
||||
mod calendar;
|
||||
mod cli;
|
||||
mod completion;
|
||||
mod config;
|
||||
mod event;
|
||||
mod help;
|
||||
mod history;
|
||||
mod keyconfig;
|
||||
mod pane;
|
||||
mod table;
|
||||
mod task_report;
|
||||
|
||||
/// # Panics
|
||||
/// Will panic if could not obtain terminal
|
||||
pub fn setup_terminal() -> Terminal<CrosstermBackend<io::Stdout>> {
|
||||
|
|
|
@ -18,7 +18,8 @@ use tui::{
|
|||
widgets::{Block, BorderType, Borders, Clear, Paragraph, StatefulWidget, Widget},
|
||||
};
|
||||
|
||||
use crate::app::{Action, Mode, TaskwarriorTui};
|
||||
use crate::action::Action;
|
||||
use crate::app::{Mode, TaskwarriorTui};
|
||||
use crate::event::Key;
|
||||
use crate::pane::Pane;
|
||||
use crate::table::TableState;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use anyhow::Result;
|
||||
|
||||
use crate::app::{Action, Mode, TaskwarriorTui};
|
||||
use crate::action::Action;
|
||||
use crate::app::{Mode, TaskwarriorTui};
|
||||
use crate::event::Key;
|
||||
use clap::App;
|
||||
use std::ops::Index;
|
||||
|
|
|
@ -18,7 +18,8 @@ use tui::{
|
|||
widgets::{Block, Widget},
|
||||
};
|
||||
|
||||
use crate::app::{Action, Mode, TaskwarriorTui};
|
||||
use crate::action::Action;
|
||||
use crate::app::{Mode, TaskwarriorTui};
|
||||
use crate::event::Key;
|
||||
use crate::pane::Pane;
|
||||
use crate::table::TableState;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue