mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-25 17:57:19 +02:00
Autoformat code
This commit is contained in:
parent
03b5cdb7ca
commit
9c2e296484
5 changed files with 19 additions and 21 deletions
12
src/app.rs
12
src/app.rs
|
@ -1,8 +1,8 @@
|
|||
use crate::calendar::Calendar;
|
||||
use crate::task_report::TaskReportTable;
|
||||
use crate::help::Help;
|
||||
use crate::config::TConfig;
|
||||
use crate::help::Help;
|
||||
use crate::table::{Row, Table, TableState};
|
||||
use crate::task_report::TaskReportTable;
|
||||
use crate::util::Events;
|
||||
use crate::util::Key;
|
||||
|
||||
|
@ -120,7 +120,6 @@ pub enum AppMode {
|
|||
Calendar,
|
||||
}
|
||||
|
||||
|
||||
pub struct TTApp {
|
||||
pub should_quit: bool,
|
||||
pub state: TableState,
|
||||
|
@ -135,7 +134,7 @@ pub struct TTApp {
|
|||
pub calendar_year: i32,
|
||||
pub mode: AppMode,
|
||||
pub config: TConfig,
|
||||
pub task_report_show_info: bool
|
||||
pub task_report_show_info: bool,
|
||||
}
|
||||
|
||||
impl TTApp {
|
||||
|
@ -252,8 +251,7 @@ impl TTApp {
|
|||
.split(rects[0]);
|
||||
|
||||
self.draw_task_report(f, full_table_layout[0]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
let split_task_layout = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([Constraint::Percentage(50), Constraint::Percentage(50)].as_ref())
|
||||
|
@ -262,7 +260,7 @@ impl TTApp {
|
|||
self.draw_task_report(f, split_task_layout[0]);
|
||||
self.draw_task_details(f, split_task_layout[1]);
|
||||
}
|
||||
let selected = self.state.selected().unwrap_or_default();
|
||||
let selected = self.state.selected().unwrap_or_default();
|
||||
let task_id = if tasks_len == 0 {
|
||||
0
|
||||
} else {
|
||||
|
|
|
@ -270,7 +270,11 @@ impl TConfig {
|
|||
if line.starts_with(config) {
|
||||
return line.trim_start_matches(config).trim_start().trim_end().to_string();
|
||||
} else if line.starts_with(&config.replace('-', "_")) {
|
||||
return line.trim_start_matches(&config.replace('-', "_")).trim_start().trim_end().to_string();
|
||||
return line
|
||||
.trim_start_matches(&config.replace('-', "_"))
|
||||
.trim_start()
|
||||
.trim_end()
|
||||
.to_string();
|
||||
}
|
||||
}
|
||||
"".to_string()
|
||||
|
|
13
src/help.rs
13
src/help.rs
|
@ -1,14 +1,13 @@
|
|||
use std::cmp;
|
||||
|
||||
use tui::{
|
||||
layout::{Alignment, Rect},
|
||||
buffer::Buffer,
|
||||
layout::{Alignment, Rect},
|
||||
style::{Modifier, Style},
|
||||
text::{Text, Span, Spans},
|
||||
widgets::{Block, Widget, BorderType, Borders, Clear, Paragraph},
|
||||
text::{Span, Spans, Text},
|
||||
widgets::{Block, BorderType, Borders, Clear, Paragraph, Widget},
|
||||
};
|
||||
|
||||
|
||||
const TEXT: &str = include_str!("../KEYBINDINGS.md");
|
||||
|
||||
pub struct Help {
|
||||
|
@ -25,16 +24,14 @@ impl Help {
|
|||
|
||||
impl Widget for &Help {
|
||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||
let text: Vec<Spans> = TEXT.lines()
|
||||
.map(|line| Spans::from(format!("{}\n", line)))
|
||||
.collect();
|
||||
let text: Vec<Spans> = TEXT.lines().map(|line| Spans::from(format!("{}\n", line))).collect();
|
||||
|
||||
Paragraph::new(text)
|
||||
.block(
|
||||
Block::default()
|
||||
.title(Span::styled(&self.title, Style::default().add_modifier(Modifier::BOLD)))
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_type(BorderType::Rounded),
|
||||
)
|
||||
.alignment(Alignment::Left)
|
||||
.render(area, buf);
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
mod app;
|
||||
mod calendar;
|
||||
mod task_report;
|
||||
mod help;
|
||||
mod config;
|
||||
mod help;
|
||||
mod table;
|
||||
mod task_report;
|
||||
mod util;
|
||||
|
||||
use crate::util::{destruct_terminal, setup_terminal, Event, EventConfig, Events};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use chrono::{Datelike, Local, NaiveDate, NaiveDateTime, TimeZone};
|
||||
use task_hookrs::task::Task;
|
||||
use std::process::Command;
|
||||
use std::error::Error;
|
||||
use std::process::Command;
|
||||
use task_hookrs::task::Task;
|
||||
|
||||
pub fn vague_format_date_time(from_dt: NaiveDateTime, to_dt: NaiveDateTime) -> String {
|
||||
let mut seconds = (to_dt - from_dt).num_seconds();
|
||||
|
@ -31,7 +31,6 @@ pub fn vague_format_date_time(from_dt: NaiveDateTime, to_dt: NaiveDateTime) -> S
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
pub struct TaskReportTable {
|
||||
pub labels: Vec<String>,
|
||||
pub columns: Vec<String>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue