Merge pull request #316 from kdheepak/fix-report-all

Allow using --report=all
This commit is contained in:
Dheepak Krishnamurthy 2021-11-03 08:18:15 -06:00 committed by GitHub
commit ae51e928cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 17 deletions

View file

@ -1568,15 +1568,15 @@ impl TaskwarriorTui {
task.arg("rc.json.array=on");
task.arg("rc.confirmation=off");
if self.task_version >= *LATEST_TASKWARRIOR_VERSION {
if !self.filter.as_str().trim().is_empty() && self.task_version >= *LATEST_TASKWARRIOR_VERSION {
task.arg(format!("'{}'", self.filter.as_str().trim()));
} else {
} else if !self.filter.as_str().trim().is_empty() {
task.arg(self.filter.as_str().trim());
}
if !self.current_context_filter.is_empty() && self.task_version >= *LATEST_TASKWARRIOR_VERSION {
if !self.current_context_filter.trim().is_empty() && self.task_version >= *LATEST_TASKWARRIOR_VERSION {
task.arg(format!("'{}'", self.current_context_filter.trim()));
} else if !self.current_context_filter.is_empty() {
} else if !self.current_context_filter.trim().is_empty() {
task.arg(format!("'\\({}\\)'", self.current_context_filter));
}
@ -4401,18 +4401,6 @@ mod tests {
test_case(&expected);
}
// #[test]
fn test_app() {
let mut app = TaskwarriorTui::new("next").unwrap();
app.update(true).unwrap();
let backend = TestBackend::new(80, 20);
let mut terminal = Terminal::new(backend).unwrap();
app.render(&mut terminal).unwrap();
println!("{}", buffer_view(terminal.backend().buffer()));
}
// #[test]
fn test_graphemes() {
dbg!("写作业".graphemes(true).count());
@ -4445,4 +4433,16 @@ mod tests {
let position = TaskwarriorTui::get_position(&app.modify);
dbg!(position);
}
// #[test]
fn test_app() {
let mut app = TaskwarriorTui::new("all").unwrap();
app.update(true).unwrap();
let backend = TestBackend::new(80, 20);
let mut terminal = Terminal::new(backend).unwrap();
app.render(&mut terminal).unwrap();
println!("{}", buffer_view(terminal.backend().buffer()));
}
}

View file

@ -398,7 +398,9 @@ impl Config {
}
fn get_filter(data: &str, report: &str) -> Result<String> {
if let Some(s) = Self::get_config(
if report == "all" {
Ok("".into())
} else if let Some(s) = Self::get_config(
format!("uda.taskwarrior-tui.task-report.{}.filter", report).as_str(),
data,
) {