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