Merge pull request #93 from desbma/taskrc-default-filter

Get default filter from taskrc (fixes #92)
This commit is contained in:
Dheepak Krishnamurthy 2021-02-13 16:23:46 -07:00 committed by GitHub
commit 38e4341815
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -169,7 +169,7 @@ impl TTApp {
help_popup: Help::new(),
contexts: vec![],
};
for c in "status:pending ".chars() {
for c in app.config.default_filter.chars() {
app.filter.insert(c, 1);
}
app.get_context()?;

View file

@ -63,6 +63,7 @@ impl TaskWarriorBool for str {
pub struct Config {
pub enabled: bool,
pub color: HashMap<String, TColor>,
pub default_filter: String,
pub obfuscate: bool,
pub print_empty_columns: bool,
pub rule_precedence_color: Vec<String>,
@ -86,6 +87,7 @@ impl Config {
obfuscate: bool_collection.get("obfuscate").cloned().unwrap_or(false),
print_empty_columns: bool_collection.get("print_empty_columns").cloned().unwrap_or(false),
color: Self::get_color_collection()?,
default_filter: Self::get_default_filter(),
rule_precedence_color: Self::get_rule_precedence_color(),
uda_task_report_show_info: Self::get_uda_task_report_show_info(),
uda_task_report_looping: Self::get_uda_task_report_looping(),
@ -310,6 +312,10 @@ impl Config {
.collect::<Vec<_>>()
}
fn get_default_filter() -> String {
Self::get_config("report.next.filter")
}
fn get_uda_task_report_show_info() -> bool {
Self::get_config("uda.taskwarrior-tui.task-report.show-info")
.get_bool()