This moves the helper function for getting the `Config` object from the
configuration file via the runtime.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
because we return `libimagstore::iter::Entries` here now, we do not have
to pass the store anymore.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
We Iterator::filter here, so we have to negate - because we list
everything where _no_ instance exists yet.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
When listing timetrackings, we do not want to print an empty table if
there aren't any timetrackings.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch adds a wrapping functionality to imag-log.
The commandline parameter `-w` or `--wrap` can not be used to wrap the
output at N characters, defaulting to 80 characters.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch removes the magic constant we used when calling
`trace_unwrap_exit()` or `map_err_trace_exit_unwrap()`.
We used to call it with `1` as parameter, where the number was the exit
code to use. Now the implementation of the function does it
automatically (using 1 (one) as exit code).
All calls of these functions were fixed. Thanks to vim this was easy.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This is a small optimization so that we do not print the information if
the output is a pipe anyways.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Because this API only errors when write!() errors occur, we can return
the exit code as an error here.
This way the user of the API can immediately exit if there was an IO
error, but the API automatically takes care of the right return value,
returning (exiting) with zero (0) if there was an "Broken pipe" error
and with one (1) otherwise, which is the expected behaviour here.
All calls to that API were changed accordingly.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
If we call 'imag-habit' without a subcommand, we assume "today". Thus it
might occur that the "status" subcommand match is not present, hence we
have to assume `false` here as default value.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
The filter filters from now to the first second of the next month, not
the first second of the current month. Hence we have to add one here.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
The UI is configured to require the 'start-time' parameter, so we do not
need to check for None here.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch simplifies the code to be not three nested matches but rather
one match and then some function chaining.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This does optimize the implementation of the list command implementation
(code-structure wise, not performance wise).
Functionality not altered.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
In the imag-contact crate we had to rewrite the ask_continue!{} macro
as a function for less headache, but besides that this is a rather
straight-forward patch for adapting to the new interface.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This fixes a bug where a re-import of the contacts directory failed
because some entries already exist.
With this change, one can import the contact directory after things
changed in there and the imag database is updated accordingly, but not
altered. So links and notes are persisting.
For completeness: before, the workflow was to
`cd $IMAG_RTP && git rm store/contacts -r && imag contact import /path/to/contacts`
which is of course not optimal.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
The current implementation does not panic on VcardBuilder::build(), so
we unwrap() that directly.
Should be fixed in future versions of either rust-vobject or here, so
that we error appropriately.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This reverts commit a1f0872486995b80216e8a08a2176debdef3752a.
As updating handlebars needs some more involvement, we roll back to the
version we use currently and schedule the update for later.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch fixes a bug where entries where created with
`Store::retrieve()` rather than with the API from libimagdiary.
This caused headers to be missing.
Now, the CLI is parsed for the values passed and a NaiveDateTime object
is crafted from that, which is then passed to libimagdiary.
The problem was that the used `Diary::diary_names()` iterator does not
call `unique()` on its output.
That decision was made because the return type would get more
complicated with that feature.
Now that rustc 1.26 with Impl Trait is out, we can refactor the return
types of these functions (so also with `Diary::diary_names()`) to
automatically do this.
This reverts commit b90abfb868.
Because `libimagcontact` is not based on `libimagentryref` anymore (as
of 2b10ab0b36), and thus does not put
pathes into the header, we can allow non-absolute pathes here.
The edit command of imag-diary gets removed by this patch.
The rationale is that imag-edit is way more powerful and thus, not every
other imag module should implement an edit command. Chaining
`imag-diary list` and `imag edit -I` is encouraged.
We still need the edit functionality in imag-diary, as `imag diary
create` shall spawn an editor, still. We only remove the ability for
editing of existing entries with this patch.
In case of auto-generating the file name, we should add an extension.
If we do not auto-generate the file name, we should warn that the
extension for the file is missing.
We should not depend on the version crate, as it is GPL licensed.
We removed the usage of this crate before, but it was still in the
Cargo.toml files (despite being used in the source).