Commit graph

1020 commits

Author SHA1 Message Date
adca7a4a1c Remove old implementation
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-11-09 17:35:06 +01:00
01db294700 Add Runtime::input_is_pipe()
We need this because we might want to check whether we can get the STDIN
handle from the runtime or not.
In some (rare) cases, the runtime "thinks" that STDIN is a stream of
IDs, but it is not. So the client can check whether stdin is a pipe
(thus, whether Runtime thinks that there's a stream of IDs) and easily
work around that by taking ::std::io::stdin() itself.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-11-09 15:51:09 +01:00
cc8150e0a9 Add extension trait for iterator over Result<Entry>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-27 13:39:34 +01:00
39cf75a532 Add iterator extensions for store-id touched reporting
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-27 13:39:34 +01:00
106be5746d Revert "Add extension traits for handling Result<Option<T>, E> conversion"
This reverts commit d810b63886f4006d01bca894982bbc867616f37c.

As resiter v0.4.0 does provide this extension now, we don't need it in
the codebase anymore.
2019-10-26 18:16:37 +02:00
0e20b25091 Add extension traits for handling Result<Option<T>, E> conversion
This extension traits help transforming Result<Option<T>, E> to
Result<T, E> or transforming an iterator over the former type to an
iterator over the latter type.

Should be moved to resiter of course, but we need to implement this
first.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
19f6391d8a Implement Error for ExitCode
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
e3db947e68 Add Entry::set_content()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:24:02 +02:00
e331b9efb3 Pass the path to the ui builder function when creating a mock application
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 15:00:09 +02:00
Leon Schuermann
7a37c47263 Add ImagApplication trait for CLI completion + single-binary support
To re-add the imag-binary CLI completion, as well as to enable
building a single imag containing all of the subcommands, this commit
introduces an ImagApplication trait to be implemented by all imag
binary crates. The binary crates will be converted to libraries, with
an additional binary target. This enables standalone and single binary
builds.

On its own, this commit doesn't do much, but rather it paves the way
to dynamically interacting with the imag uis/clis using a
library-crate interface.

Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
2a407d161b Add some debug output
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 09:57:05 +02:00
7348378a96 Fix test: Check whether in cache, then get, then check again
After moving an entry, the entry should _not_ be in the cache. This is
just a decision that has to be made, whether we cache the moved entry or
not. I decided to not cache because it is results in less code.

After that check, we get the entry from the backend and then we can
check whether the entry is in the cache, which is then should be.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 09:57:05 +02:00
583f972788 Add test: Test moving entry with writing to it before and after moving
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 09:57:05 +02:00
d1078590c7 Fix: Testing backend bug where an entry was not properly rewritten
When moving an entry, what we did is copying the entry inside the
backend abstraction (the hashmap) from one key to another.

But as the entry itself does also encode its location, we actually have
to rewrite the entire entry. This patch fixes this.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 09:57:05 +02:00
a07e03a25c Fix: Renaming entries should also remove the old entry
This is a bugfix for a bug in Store::move_entry_by_id():
The old entry was not removed after the new one was created.

The bug is a bit subtle. The issue was, that the internal cache held
open a reference to the old entry (as StoreEntry object) and when that
object got drop()ed, the contents of the entry were written to disk,
which resulted in the old entry being recreated.

This patch rewrites the function to behave well. The most critical part
is that we do not check whether the old entry is borrowed with
`hsmap.get()` but rather `hsmap.remove()`. The trick here is that the
`StoreEntry` object is dropped in the moment the check is done, clearing
the cached object and flushing it to the backend (the disk).
After that, we continue doing the filesystem operation and the cache is
clean.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 09:57:05 +02:00
2a23002a07 Fix: --override-config argument can be passed multiple times
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-13 12:21:57 +02:00
712eda074d Merge branch 'libimagcalendar/init' into master 2019-10-11 21:35:51 +02:00
b40a854c6f Add function to get all events
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-09 19:44:08 +02:00
e86f36c215 Add getter helper
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-09 19:44:08 +02:00
cf78f7192f Implement calendar library
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-09 19:44:08 +02:00
3be9407c6c Add Linkable::is_linked_to()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-09 19:44:01 +02:00
b2dffff6e8 Outsource helper: getting the link partial from Entry
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-09 19:44:01 +02:00
568e041c52 Update dependency: hex: 0.3.2 -> 0.4
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-07 18:18:28 +02:00
613b78f369 Update dependency: ansi_term: 0.11.0 -> 0.12 2019-10-07 18:18:28 +02:00
5edb470a5f Update dependency: handlebars: 1.1.0 -> 2 2019-10-07 18:18:28 +02:00
07f949056e Update dependency: env_logger: 0.6.1 -> 0.7
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-07 18:18:28 +02:00
ee5348ea23 Update dependency: url: 1.7.2 -> 2
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-07 18:05:58 +02:00
7fc3961a17 Add viewer helper trait for iterators
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-04 17:50:30 +02:00
f5a4331d0a Add helper function to parse string by several datetime formats
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-03 16:36:04 +02:00
87f2a0cb75 Add Tests for Entries::{find_by_id_substr, find_by_id_startswith} 2019-09-01 13:36:39 +02:00
84135b1961 Add Entries::{find_by_id_substr, find_by_id_startswith}
This patch adds functions to the Entries type which can be used for
filtering by id, either with `contains()` or `starts_with()`.

This is useful for the end-user functionality where the user specifies
the ID of an entry only partially.

The implementation still iterates over all entries. This could be
improved, of course, by implementing a `find`-like function on `Store`
directly. But for now, this is good enough.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-09-01 13:36:39 +02:00
flip1995
e2216db41d Allow some Clippy lints
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
0087de7af8 [No-auto] lib/etc/interaction: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
a8bb180a6a [No-auto] lib/entry/view: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
d377a999cb [No-auto] lib/entry/util: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
d605f923bb [No-auto] lib/entry/url: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
c8a7aacf99 [No-auto] lib/entry/tag: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
fae9f82c67 [No-auto] lib/entry/ref: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
69dce9ed9f [No-auto] lib/entry/link: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
9620e81f59 [No-auto] lib/entry/filter: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
36957917b2 [No-auto] lib/entry/datetime: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
db40175840 [No-auto] lib/entry/category: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
2e7706af99 [No-auto] lib/domain/todo: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
4301e80cf2 [No-auto] lib/domain/timetrack: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
8726cb12cf [No-auto] lib/domain/mail: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
6307b80027 [No-auto] lib/domain/habit: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
2ac2a86c7a [No-auto] lib/domain/bookmark: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
b2997517bb [No-auto] lib/core/store: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
7b5f216e01 [No-auto] lib/core/rt: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28 18:18:41 +02:00
flip1995
670a0ff6d7 [Auto] lib/etc/util: 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