Commit graph

6183 commits

Author SHA1 Message Date
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
a6bbcd65f4 Change output to not have quotes when printing string, int, float or bool
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-20 15:05:19 +02:00
eb85635bef Add trace output
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-20 14:48:17 +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
cc0f2bf3de Fix: Add ID reporting
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-13 12:21:47 +02:00
b29afc2dda Add more debug output
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-13 12:21:41 +02:00
b7e996ccfe Merge branch 'imag-calendar/init' into master 2019-10-11 21:37:03 +02:00
f1ec71431e Implement show subcommand
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:44 +02:00
d40bf2956f Make helper type derive Debug
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:44 +02:00
d201797b98 Add argument to only list events after a certain date
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:44 +02:00
d9ac0c0b07 Add argument to only list events before a certain date
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:44 +02:00
9801a3c295 Add helper function to parse string with kairos
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:44 +02:00
81c6ee8314 Rewrite helper to be less complicated
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:44 +02:00
3da1d9e1d9 Refactor to use new helper function
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:44 +02:00
92a0713ed0 Add filtering for past events
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:43 +02:00
14dc03f40f Enhance listing functionality with handlebars templating
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:26 +02:00
8dbb2f1590 Add basic listing functionality
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:08 +02:00
61f71d67cc Add example ref configuration for calendar
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:08 +02:00
2e6df0e458 Add imag-calendar
This patch adds a imag-calendar command which features only a "import"
command by now.

This can be used to import calendar entries (events) to imag.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11 21:36:08 +02:00
712eda074d Merge branch 'libimagcalendar/init' into master 2019-10-11 21:35:51 +02:00
33c355cd47 Merge branch 'is-linked-to' into master 2019-10-11 16:14:44 +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
df5bfd1ce3 Merge branch 'minor' into master 2019-10-08 19:52:52 +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
bddd29dfe4 Update dependency: indicatif: 0.11 -> 0.12 2019-10-07 18:06:29 +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
d5b26a7ce7 Update minimum rust version to 1.36.0
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-06 11:18:40 +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
d8df96ad1f Merge branch 'imag-create' into master 2019-10-03 17:45:02 +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
fd3b46fa46 Add imag-create plumbing command for creating entries
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-09-28 19:55:35 +02:00
af6d67416b Fix typos 2019-09-20 19:16:22 +02:00
2caeb0a510 Merge branch 'entry-find' into master 2019-09-01 13:37:18 +02:00
db3bb95227 Add user documentation
This patch adds user documentation in for of a mdbook, using a travis
job for running the build of the book in CI to be sure it builds
properly.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-09-01 13:37:05 +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
74810d9ccc Fix: Print processed IDs if output is not a pipe.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-31 13:44:19 +02:00
47044d9ffe Pull changes from https://github.com/flip1995/imag clippy_fix
This pulls in the clippy fixes from Phil. From the request-pull:

-----8<-----
    I finally got to fixing all of the Clippy warnings in the imag codebase.
    `cargo test` passes, `cargo clippy` doesn't produce any warnings
    or errors.

    Some important notes:
      - I didn't pay attention to the line length of the changes, so it may
        have happened that some lines are now longer than 100 chars
      - Except two commits the commit messages are formatted as follows:
        * The first tag shows if the changes in the commit were
          automatically applied by `cargo fix --clippy -Zunstable-options`.
          Commits that were automatically applied may require closer review,
          since I didn't check those by hand and the Clippy fix feature is
          still unstable.
        * The other tags specify the subcrate that is affected by the
          commit. I created one commit for each subcrate, even when only one
          file (most of the time the `main.rs` file) was changed.
      - I created one commit, where I replace usages of `r#try!` with the
        `?` operator, since `try!` is now officially deprecated.
      - I created one commit, where I just allow Clippy lints. Either because
        the fix would require much more work or knowledge of the codebase or
        because it was a FP.

    This was pretty much work, but it helped detecting a few bugs in Clippy,
    where I was already able to open 3 or 4 PRs. So win-win I guess.

    [...] we got a net LoC decrease.
----->8-----
2019-08-28 18:19:12 +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