do not group tasks in list if only tasks for a given day are shown

This commit is contained in:
Nikolas Schmidt-Voigt 2021-07-04 21:42:01 +02:00
parent 5f03c20706
commit 374a6e8cb4
3 changed files with 30 additions and 3 deletions

View file

@ -18,7 +18,7 @@ Bartib safes a journal of all tracked tasks in a plaintext file. The file can ei
### Help
Print help informations:
Print help information:
```
bartib -h
@ -47,3 +47,29 @@ bartib stop
```
bartib current
```
### List tasks
All tasks:
```
bartib list
```
Do not group tasks by date:
```
bartib list --no_grouping
```
List tasks in a given time range:
```
bartib list --from 2021-03-01 --to 2021-11-01
```
List tasks on a given day:
```
bartib list --date 2021-05-17
```

View file

@ -61,7 +61,8 @@ pub fn list(file_name: &str, filter: TaskFilter, do_group_tasks: bool) {
if do_group_tasks {
output::list_tasks_grouped_by_date(&filtered_tasks[first_element .. filtered_tasks.len()]);
} else {
output::list_tasks(&filtered_tasks[first_element .. filtered_tasks.len()], true);
let with_start_dates = !filter.date.is_some();
output::list_tasks(&filtered_tasks[first_element .. filtered_tasks.len()], with_start_dates);
}
}

View file

@ -111,7 +111,7 @@ fn main() {
date : get_date_argument_or_ignore(sub_m.value_of("date"), "-d/--date")
};
let do_group_tasks = !sub_m.is_present("no_grouping");
let do_group_tasks = !sub_m.is_present("no_grouping") && !filter.date.is_some();
bartib::list(file_name, filter, do_group_tasks);
},
_ => println!("Unknown command")