Commit Briefs
Add build manifest (master)
Signed-off-by: Thomas Böhler <witcher@wiredspace.de>
Add CI manifests for Arch Linux and OpenBSD
Signed-off-by: Thomas Böhler <witcher@wiredspace.de>
Add .mailmap
Signed-off-by: Thomas Böhler <witcher@wiredspace.de>
Quote extension due date format properly
Signed-off-by: Thomas Böhler <witcher@wiredspace.de>
Use HTML comments for README.md license header
Signed-off-by: Thomas Böhler <witcher@wiredspace.de>
Change copyright owner
Signed-off-by: Thomas Böhler <witcher@wiredspace.de>
Use `()` instead of `_` for closure
If the function argument to a closure is of type `()` clippy wants this to be captured with a `()`, even if the argument isn't used. Signed-off-by: Thomas Böhler <witcher@wiredspace.de>
Implement respecting the strict rule of `rec`
The `next_due` and `next_due_with_rec` methods now respect the strict attribute of the recurring rule. To still be able to test the method, a third method, `next_due_with_rec_and_date` has been created which, instead of internally computing the current date, explicitly takes the supposedly current date. The `next_due_with_rec_and_date` method is public for now but might be made private, depending on how useful it might be. Implements: https://todo.sr.ht/~witcher/todotxt/4
Add methods relating to recurring tasks
Basic recurring task functionality has been implemented in this patch, but the strict recurring rule is still missing and needs to be implemented. This is quite hard to do while keeping the methods testable as the strict rule relies on the current date, which currently is not being taken via a parameter. References: https://todo.sr.ht/~witcher/todotxt/4
Add getter/setter to `Task`
The attributes of the `Task` struct will remain private and access is granted through getter and setter. Additionally, methods for adding tags have been added.
Remove field `tags` from struct `Task` altogether
As the `tags` field is essentially just a view into the `description` field and keeping both fields synchronised can be a burden, the `tags` field has been removed and tags will now be computed on the fly, if necessary. Additionally, `description` has been changed to a `Cow` since it can change and thus needs to be able to be an owned type. It nothing is changed, however, the description will still only be a slice of the original one, avoiding multiple copies being stored in memory. If the description of the task needs to be changed, `description` will become an owned field.
Restrict field access on `Task`
The `Task` struct has 2 fields that rely on each other: `description` and `tags`. Changing one will most likely mean a change in the other, and changing `tags` by itself probably makes no sense. Both fields have been made private, forcing instantiation with `Task::new` and forcing changes to go through the `set_description` method, both computing the `tags` from the description.
Make fields of types public, strict completion
All fields in all structs in `types.rs` have been made public. The `completed` field in `Tag` has been replaced with a `completion` field with type `Completion`. This encodes in the type system that a task can only ever has a date of completion if it is actually complete.
Mark `Tag` as `non_exhaustive`
Since it is planned to add more tags later on, `Tag` is now marked as `non_exhaustive`.
Add TryFrom implementation for Task and unit tests
`Task` can now be created from `&str` via `TryFrom`. The `new_key_value` method on `Tag` now has unit tests.
