Commit Graph

6335 Commits

Author SHA1 Message Date
Matthias Beyer 05685a6f2d Remove calls to exit() and replace them with error propagation up to main()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
Matthias Beyer 4b8ca2b110 Remove calls to exit() and replace them with error propagation up to main()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
Matthias Beyer fd40715b29 Remove calls to exit() and replace them with error propagation up to main()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
Matthias Beyer 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
Matthias Beyer e7e5d30645 Remove calls to exit() and replace them with error propagation up to main()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
Matthias Beyer 6ab5d1d880 Remove calls to exit() and replace them with error propagation up to main()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
Matthias Beyer 647ca2fea6 Remove calls to exit() and replace them with error propagation up to main()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
Matthias Beyer b36454ac38 Refactor to not call exit() anywhere
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
Matthias Beyer e259015a61 Remove calls to exit() and replace them with error propagation up to main()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
Matthias Beyer 19f6391d8a Implement Error for ExitCode
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:35:31 +02:00
Matthias Beyer e3db947e68 Add Entry::set_content()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:24:02 +02:00
Matthias Beyer 447a73f438 Fix indention
It seems Leon messed up here... :-)

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 16:23:16 +02:00
Matthias Beyer 7a06544654 Merge Leons patches for single-binary and CLI completion preparation
This merge pulls in the changes that Leon developed over the course of
the last months which change the binaries to actually be libraries with
a _very_ minimal binary surface. This enables us to actually generate
commandline completion scripts with clap without doing any fancy
file-include magic in a build.rs script.

From the original request-pull message (Mon, 24 Jun 2019 21:48:51 +0200):

> This patch is yet another attempt at bringing CLI completion to this
> workspace project. The details are explained in the commit message.
>
> Advantages of this approach include:
> - Use of standard dependency management features (`cargo install`
>   compatible)
> - Exposing further "binary" business logic to other Rust crates as a
>   library
> - (Possibly) hard linking the "binary" into the main imag binary, so
>   only one binary needs to be shipped. This should improve startup time,
>   and the Runtime instance could even be reused. I'd favor this
>   approach, while making it all configurable via features and still
>   searching the $PATH to allow bash-scripts etc. to provide imag
>   subcommands.
>
> However, this *could* increase binary size, I didn't perform any
> measures (at least when not only using in the build script but in the
> main binary as well). Anyhow, with LTO enabled this shouldn't matter if
> the dependencies aren't used.

Some patches were added by me before the merge, because Leon did not
check whether the tests still work (just minimal adjustments, see the
log).

Also, one change was made to the final patchset send by Leon, which was
a fixup of the Copyright date in bin/core/imag/build.rs. This change
does not appear in the commit logs because it was just bumping the year
from 2018 to 2019 in the Copyright header. This was acked by Leon in a
private conversation.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 15:15:35 +02:00
Matthias Beyer ae7a633ab3 Fix: Pass path to ui builder function when creating mock app
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 15:00:37 +02:00
Matthias Beyer c301b4b0ab Fix: Pass path to ui builder function when creating mock app
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 15:00:37 +02:00
Matthias Beyer 47ba9fd2eb Fix: Pass path to ui builder function when creating mock app
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 15:00:37 +02:00
Matthias Beyer 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 26b05b4bb9 imag-calendar: implement ImagApplication & add CLI completion
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:48 +02:00
Leon Schuermann e66f29187f imag-create: implement ImagApplication & add CLI completion
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:48 +02:00
Leon Schuermann 82e209bea8 Introduce CLI completion support
This is yet another attempt to bring CLI completion to this workspace
project.

It uses the subcommand-libraries implementing the ImagApplication
trait to expose the clap CLI interface. This way, no file import magic
happens, it's all just regular dependencies, which should also work
with a regular `cargo install`.

Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann e840d4502c imag-wiki: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 2a1e78c705 imag-todo: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann e1dbb596a1 imag-timetrack: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 6590a4b8cb imag-notes: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 870a09f1dc imag-mail: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 4c918c78c0 imag-log: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 621c5f96f8 imag-habit: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 3e12bd99d4 imag-diary: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 3144080488 imag-contact: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann cb69214e72 imag-bookmark: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann ccbd5a1a52 imag-view: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann a68d1ce839 imag-tag: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 4683b205b6 imag-store: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann fec52bdbc5 imag-ref: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 186b03deea imag-mv: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 4c9998ca1d imag-markdown: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann aa851a87f5 imag-link: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 208d6e62e6 imag-init: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 0739fed666 imag-ids: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 97c46da599 imag-header: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann a7d55930d7 imag-grep: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 58ac2caf20 imag-gps: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann bfe15c9157 imag-git: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 861af28724 imag-edit: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann a34450a37e imag-diagnostics: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann 79cfa8d9d8 imag-category: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +02:00
Leon Schuermann ec75892516 imag-annotate: implement ImagApplication
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26 14:41:31 +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
Matthias Beyer 564a740741 Merge branch 'store-fixes' into master
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 10:43:14 +02:00
Matthias Beyer 2a407d161b Add some debug output
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26 09:57:05 +02:00