mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-26 03:07:18 +02:00
Add uda.taskwarrior-tui.task-report.show-info
This commit is contained in:
parent
b74dc184cd
commit
5689f444e7
2 changed files with 17 additions and 9 deletions
11
src/app.rs
11
src/app.rs
|
@ -358,11 +358,12 @@ pub struct TTApp {
|
|||
pub calendar_year: i32,
|
||||
pub mode: AppMode,
|
||||
pub config: TConfig,
|
||||
pub hide_task_detail: bool
|
||||
pub task_report_show_info: bool
|
||||
}
|
||||
|
||||
impl TTApp {
|
||||
pub fn new() -> Result<Self, Box<dyn Error>> {
|
||||
let c = TConfig::default()?;
|
||||
let mut app = Self {
|
||||
should_quit: false,
|
||||
state: TableState::default(),
|
||||
|
@ -374,10 +375,10 @@ impl TTApp {
|
|||
modify: LineBuffer::with_capacity(MAX_LINE),
|
||||
error: "".to_string(),
|
||||
mode: AppMode::TaskReport,
|
||||
config: TConfig::default()?,
|
||||
task_report_show_info: c.uda_task_report_show_info,
|
||||
config: c,
|
||||
task_report_table: TaskReportTable::new()?,
|
||||
calendar_year: Local::today().year(),
|
||||
hide_task_detail: false,
|
||||
};
|
||||
for c in "status:pending ".chars() {
|
||||
app.filter.insert(c, 1);
|
||||
|
@ -467,7 +468,7 @@ impl TTApp {
|
|||
.constraints([Constraint::Min(0), Constraint::Length(3)].as_ref())
|
||||
.split(f.size());
|
||||
|
||||
if self.hide_task_detail {
|
||||
if !self.task_report_show_info {
|
||||
let full_table_layout = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([Constraint::Percentage(100)].as_ref())
|
||||
|
@ -1543,7 +1544,7 @@ impl TTApp {
|
|||
self.mode = AppMode::TaskFilter;
|
||||
}
|
||||
Key::Char('z') => {
|
||||
self.hide_task_detail = !self.hide_task_detail;
|
||||
self.task_report_show_info = !self.task_report_show_info;
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
|
|
|
@ -34,6 +34,7 @@ pub struct TConfig {
|
|||
pub obfuscate: bool,
|
||||
pub print_empty_columns: bool,
|
||||
pub rule_precedence_color: Vec<String>,
|
||||
pub uda_task_report_show_info: bool,
|
||||
pub uda_selection_indicator: String,
|
||||
pub uda_selection_bold: bool,
|
||||
pub uda_selection_italic: bool,
|
||||
|
@ -79,6 +80,7 @@ impl TConfig {
|
|||
print_empty_columns: bool_collection.get("print_empty_columns").cloned().unwrap_or(false),
|
||||
color: Self::get_color_collection()?,
|
||||
rule_precedence_color: Self::get_rule_precedence_color(),
|
||||
uda_task_report_show_info: Self::get_uda_task_report_show_info(),
|
||||
uda_selection_indicator: Self::get_uda_selection_indicator(),
|
||||
uda_selection_bold: Self::get_uda_selection_bold(),
|
||||
uda_selection_italic: Self::get_uda_selection_italic(),
|
||||
|
@ -280,6 +282,14 @@ impl TConfig {
|
|||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
fn get_uda_task_report_show_info() -> bool {
|
||||
let s = Self::get_config("uda.taskwarrior-tui.task-report.show-info");
|
||||
match s.get_bool() {
|
||||
Some(b) => b,
|
||||
None => true,
|
||||
}
|
||||
}
|
||||
|
||||
fn get_uda_selection_indicator() -> String {
|
||||
let indicator = Self::get_config("uda.taskwarrior-tui.selection.indicator");
|
||||
if indicator.is_empty() {
|
||||
|
@ -322,7 +332,7 @@ impl TConfig {
|
|||
}
|
||||
|
||||
fn get_uda_months_per_row() -> usize {
|
||||
let s = Self::get_config("uda.taskwarrior-tui.calendar.months_per_row");
|
||||
let s = Self::get_config("uda.taskwarrior-tui.calendar.months-per-row");
|
||||
match s.parse::<usize>() {
|
||||
Ok(i) => i,
|
||||
Err(e) => 4,
|
||||
|
@ -336,8 +346,5 @@ mod tests {
|
|||
#[test]
|
||||
fn test_colors() {
|
||||
let tc = TConfig::default();
|
||||
dbg!(&tc.color["color.active"]);
|
||||
dbg!(&tc.color["color.due.today"]);
|
||||
dbg!(&tc.rule_precedence_color);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue