We do not need to check via regex here, because the previous checks are
already more restrictive than the regex itself.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch updates all dependencies but not "nom".
Done with `cargo upgrade --all` and manual editing.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch changes the HabitInstance implementation so that the comment
is not expected to exist in the instance object itself.
This is done for less data duplication.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch rewrites the get_tags() function to use toml_query::read::Partial.
The helper functions is_tag_str and is_tag are rewritten for
compatiblity.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch adds support for directional links in libimagentrylink.
A directional link is added to the same header as the "internal" links,
which are unidirectional.
The "outgoing" link is added in "links.to", the "incoming" links are
added to "links.from".
This way we can always traverse all linkage. The `Linkable::links()`
method is changed to always return _all_ link.
The `Link` type was extended for notions of "to" and "from" links.
Also adds testing.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch removes the annotateable linking feature from libimagentrylink.
It was not used anyways.
Also, this patch rewrites the complete linking code to use the
toml-query "typed" feature rather than constructing everything by
itself.
This removes a lot of unmaintainable boilerplate code.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
With this patch, the libimagentrylink library interface gets renamed.
The trait gets renamed to the more descriptive name "Linkable", the
functions get renamed to not contain any notion of "internal" anymore.
This patch also adapts the whole source tree for the new libimagentrylink
interface, also renaming variables to not contain "_internal_" anymore.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Because we need to catch errors that are caused by a borken pipe when
writing to stdout (for example), this patch changes the interface of the
Viewer trait to return an error enum that can be used to check whether
an IO error happened.
The calling code can then decide whether to ignore a broken pipe error
or whether to handle it properly.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch adds the "serde" feature to the "log" dependency, so we can
deserialize logging levels directly into "log" types.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch rewrites the logging config deserialization. It removes the
manual traversing of the config toml structure and replaces it with
types which implement `Deserialize`, which is way more convenient and
easy to read (and extend).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Prior to this change, the IdPathProvider implementation would be
responsible for exiting the process on insufficient / wrong arguments.
However, such error handling should be performed together with the
business logic and not in CLI-parsing related code.
This change introduces a clear separation: both parsing errors and
insufficient id path arguments can now be return from inside the
`get_ids`-method, and get passed up to the application logic to be
handled.
This change is reflected in all instances of IdPathProvider and their
surrounding code.
Signed-off-by: Leon Schuermann <leon.git@is.currently.online>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch changes the Entries::in_collection() interface to return a
Result<()>. This is needed because the fs backend implementation should
be able to check whether a directory actually exists whenever we change
the iterator.
If the implementation detects that the directory does not exist, we can
fail early and error out.
All usages of the interface are adapted by the patch as well.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This function needs to be removed because of the following problem:
When linking from one entry to another, and then removing the link in
the first entry with ::set_internal_links(vec![]), we end up with a
dangling link in the second entry, because the ::set_internal_links()
function does not take care of removing the links in the "other"
entries.
Actually, it is not even able to do so, because it would need to
`Store::get()` those entries, but it does not have access to the store.
Adding a `store` parameter to the function would be possible, but only
increase its complexity unnecessarily. This is why I opt for removing
this function (which is btw not used once in the whole imag codebase).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch changes the Log::is_log() implementation for Entry to use the
provide_kindflag_path!() infrastructure.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
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>