Commit Graph

46 Commits

Author SHA1 Message Date
flip1995 777c9e59f1 [Auto] lib/domain/diary: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:40 +02:00
Matthias Beyer a21d4b7122 Add DiaryId::get_date_representation() function
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-06-30 10:56:55 +02:00
Matthias Beyer 3e22fbe352 Fix imports for new viewer interface
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-30 11:12:44 +02:00
Matthias Beyer 1f97584738 Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:54:35 +02:00
Matthias Beyer 1d89844613 Run 'cargo fix' for rust-2018
With this patch we move the codebase to Rust-2018.

The diff was generated by executing

    cargo fix --all --all-features --edition

on the codebase.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18 00:20:59 +02:00
Matthias Beyer b8cd9c6efa Add debug output
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-14 00:16:47 +02:00
Matthias Beyer cb4d5367e4 Rewrite all usages of ModuleEntryPath
Because the code was so complex before, we had to create an object and
then cast that object into a `StoreId` rather than just creating a
`StoreId` object right away.

With this patch, we're using the code-generation approach to generate a
function that creates a `StoreId` object based on the name of the
current module. That's way easier and error handling was also improved
by the switch to the new implementation.

The patch also includes a rewrite of all usages of ModuleEntryPath and
changes them to `module_path::new_id()` calls.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-04-13 22:39:39 +02:00
Matthias Beyer 71cccad665 Remove old comment
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-03-09 13:30:12 +01:00
Matthias Beyer ca2f130995 Rewrite: Diary::get_youngest_entry_id()
Rewrite to collect not so often internally. This removes one collect()
from the implementation. One is still there in the sorted_by() call,
though.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-03-09 13:30:12 +01:00
Matthias Beyer 205c2b09b6 Remove outcommented code
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-03-09 12:26:21 +01:00
Matthias Beyer 187b948985 Adapt to new libimagstore::iter::Entries API
Use Entries::into_storeid_iter() for transforming iterator into right
type.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15 20:53:29 +01:00
Matthias Beyer 9185abcfa5 Update copyright years
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-01-03 18:41:36 +01:00
Matthias Beyer 9fca66aa89 Forbid unsafe code in all crates 2018-11-11 13:05:55 +01:00
Matthias Beyer 3951bc7e5d libimagdiary: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 22d63f0946 Add functionality to create entry at a certain time 2018-07-20 01:37:36 +02:00
Matthias Beyer bf0bef058d Refactor libimagdiary to fit new store iterator interface 2018-05-01 17:44:00 +02:00
Matthias Beyer 55d9b5456f Adapt to new libimagentryview interface
And properly implement Viewer for DiaryViewer
2018-04-24 16:46:15 +02:00
Matthias Beyer 5666ef12d0 Rewrite to not use Store::retrieve_for_module() 2018-04-24 14:01:40 +02:00
Matthias Beyer 9303a72a28
Merge pull request #1436 from matthiasbeyer/imag-log/show-ordered
Fix: imag-log show should order by datetime
2018-04-22 15:55:25 +02:00
Matthias Beyer ee75d2309c Fix: imag-log show should order by datetime 2018-04-22 14:33:53 +02:00
Matthias Beyer 86b60295ee Fix: get_youngest_entry_id()
We need to reverse the iterator for getting the _youngest_ entry here.

Also seems to fix the issue that imag-diary edit -d <date> did not work
properly.
2018-04-22 14:11:19 +02:00
Matthias Beyer ae5c4cf9ba Fix: view entries sorted 2018-04-13 13:41:02 +02:00
Matthias Beyer 8c37fb865a Rebuild DiaryEntryIterator to be based on StoreIdIterator
This patch rebuilds DiaryEntryIterator to be a wrapper around
StoreIdIterator and thus `Diary::entries()` to use `Store::entries` and
not `Store::retrieve_for_module()`.

The `Store::retrieve_for_module()` function is somehow buggy and loads
contents of the files into memory and _somehow_ causes the entries to be
rewritten without newlines.

This bug is fixed by moving away from `Store::retrieve_for_module()`.
2018-03-02 21:25:48 +01:00
Matthias Beyer b2048b3dcf
Merge pull request #1306 from matthiasbeyer/minor
Minor patches
2018-02-20 20:23:41 +01:00
Matthias Beyer 404e9deed2 Add some debug output 2018-02-20 17:29:03 +01:00
Matthias Beyer 585261d468 Add "isflag" support 2018-02-20 17:18:46 +01:00
Matthias Beyer d5a9e4930d Update dates in license header
And add missing header in one file
2018-02-07 02:48:53 +01:00
Matthias Beyer 46774d765b libimagdiary: Replace read with typed read 2018-01-13 01:14:03 +01:00
Matthias Beyer 0640bdeb73 Add second-support in libimagdiary 2018-01-04 19:39:07 +01:00
Matthias Beyer e758a28c9e Replace uses of try!() macro with "?" operator 2017-10-31 15:04:50 +01:00
Matthias Beyer b237adfe19 Fix calls to Runtime::config() to use direct result 2017-10-31 09:25:14 +01:00
Matthias Beyer da4d670cbc Base IsInDiary::is_in_diary() on StoreId::is_in_collection(), which is tested 2017-09-20 18:48:55 +02:00
Matthias Beyer c115215fa4 Merge branch 'master' into libimagerror/integration
This merge solved a _LOT_ of conflicts and was a rather complicated one,
as parts of the conflict-resolution involved rewriting of half the
stuff.

This merge commit fixes all the things so a `cargo check --all`
succeeds, but I did not yet check whether tests run without failure.
2017-09-04 23:02:45 +02:00
Matthias Beyer 18e806f588 Remove dedicated result modules, use error chain generated Result types 2017-09-04 09:19:29 +02:00
Matthias Beyer 7ce44e8090 Remove "IntoError" trait, use error_chain functionality 2017-09-03 21:34:07 +02:00
Matthias Beyer 677a5e8886 libimagdiary: Rewrite error handling 2017-09-03 21:33:54 +02:00
Matthias Beyer 603808a9fa Impl IntoError for error kinds 2017-09-03 15:42:06 +02:00
Matthias Beyer a309fdb280 Add recursion limits to crates 2017-09-03 15:42:06 +02:00
Matthias Beyer 11d881d3a9 Add dependency to crates: error_chain = 0.10 2017-09-03 15:42:06 +02:00
Matthias Beyer e77d353c52 Rewrite macros to do error-chain behind the scenes 2017-09-03 15:42:03 +02:00
Matthias Beyer 21c15ca207 Adapt imag-diary to compile with the new libimagdiary API 2017-09-01 11:04:07 +02:00
Matthias Beyer 31fa07d43a Add another small helper 2017-09-01 11:04:07 +02:00
Matthias Beyer 95b7da1ed2 Impl Entry (now DiaryEntry) as trait 2017-09-01 11:04:06 +02:00
Matthias Beyer 9c69645b69 Implement Diary as trait 2017-09-01 11:04:06 +02:00
Matthias Beyer ae5255c7c7 Remove unused crate imports
This patch removes unused crate imports reported by newer rust versions.

Some crates were only required for tests, some only for tests with
macro_import - these things were fixed with feature gates.
2017-08-31 10:56:15 +02:00
Matthias Beyer 59a3662ac4 Reorganize code in subdirs 2017-08-27 15:12:09 +02:00