Commit Graph

712 Commits

Author SHA1 Message Date
Matthias Beyer 91f5a33f5a Make "ask" functions get input and output streams
This way we can control where the input comes from and the output goes
to (like we want to with libimagrt).

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-01 20:30:12 +01:00
Matthias Beyer 7f0d5b8bfd Do not pass --rtp in test runtime 2018-11-01 13:19:14 +01:00
Matthias Beyer 71086b67d8 Add debug output in test runtime generating macro 2018-11-01 13:18:58 +01:00
Matthias Beyer 1a1cc885cc Merge branch 'rt-remove-default-value-verbosity'
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-01 00:05:42 +01:00
Matthias Beyer 351849e349 Fix: Remove default value for --verbose flag
This actually caused an error.

When executing `imag ids --verbose trace` for example, the `imag` binary
got the default value (as in `--verbose info`) supplied from clap. So
far, so good. Problem is that the implementation then forwarded that
flag to `imag-ids`, which resulted in the `--verbose` flag to be passed
_two times_ to `imag-ids`.

Somehow this is really strange, but it does not really matter. First of
all: A default of "Info" is still too high IMO. Default should be
warnings and errors, but no information printed. We like silent tools,
don't we?

Second is that the commandline argument forwarding mechanism of `imag`
is broken and this was a fix which helped debugging of the brokenness,
so this is acutally a step forward in this regard as well.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-31 23:13:07 +01:00
Matthias Beyer 9636cef7a8 Print (debugging) CLI when initializing runtime
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-31 23:11:06 +01:00
Matthias Beyer 59f16d0eab Add feature: Public logging initialization
This feature is required for the `imag` binary. It allows the binary to
use the imag internal logger for logging its own log output.

We need to be able to initialize the logger from an external module (in
all imag modules, the Runtime::new() implementation takes care of this,
but as we cannot use that in the `imag` binary itself, we allow this
method to be public behind a feature flag).

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-31 23:10:26 +01:00
Matthias Beyer 1d97e36c93 Add more CLI validators
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-31 17:15:29 +01:00
Matthias Beyer 366ca62eb9 Update dependency: mdcat: 0.8 -> 0.11 2018-10-31 17:15:29 +01:00
Matthias Beyer f4ff2ba250 libimagmail: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer d3c0826188 libimagtodo: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 1956099e2e libimaglog: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 57f7a5a682 libimagtimetrack: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 3951bc7e5d libimagdiary: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 2a107477c0 libimagcontact: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 2dc17f8bea libimagwiki: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 9575bb933d libimagnotes: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer ede70581f3 libimaghabit: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer c11e971139 libimagbookmark: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer a1c65603dc libimagentrydatetime: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer f3e7f677b0 libimagentryutil: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer e553d20a8f libimagentrymarkdown: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer ebe2a9a110 libimagentryview: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 9b48dc27cd libimagentryref: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 5a7def4c8e libimagentryedit: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 7f04eb2bff libimagentrygps: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 0cbc6741a7 libimagentrytag: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 32e8c43ccb libimagentrylink: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 7357f1c985 libimagentryannotation: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer a8daeb851d libimagentrycategory: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 49ec0702fd libimagentryfilter: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 8236e73402 libimagrt: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 09e8619cf5 libimagstore: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer cc503920d0 libimaginteraction: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 5627bbe454 libimagnotification: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer 72add24d87 libimagutil: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer c2f674cc29 libimagerror: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:28 +01:00
Matthias Beyer c160a967ec Add error kinds 2018-10-30 18:46:28 +01:00
Matthias Beyer 22c13fed42 Fix: `--debug` on CLI should enable logging and override it
When specifying the `--debug` flag on the commandline, logging was not
enabled. That was because the config file parsing did not consider the
args.

Now, if `--debug` is passed on the CLI, logging is enabled for all
modules and level is set to `debug` for all modules.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-26 15:41:00 +02:00
Matthias Beyer 8ec8b0aca7 Hotfix: Ignore code snippet here 2018-10-24 23:46:21 +02:00
Matthias Beyer d87ea7b305 Add StoreId::local_display_string() function
for safely creating a `String` object from `StoreId` which can be shown
to the user.

Mainly introduced because this is useful for error handling (when
putting a `StoreId` into an error kind, the compiler complains that
`StoreId` does not meet the required trait bounds. But `String` does and
we do not process the ID any further anyways).

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-13 11:52:16 +02:00
Matthias Beyer 3090a65446 Add detailed comments on how the logger works 2018-10-11 00:15:48 +02:00
Matthias Beyer cc11162dd4 Fix: In-Memory filesystem backend did not remove on rename
The implementation of the in-memory filesystem for testing imag code did
not actually use `HashMap::remove()` when an entry was moved, but
`HashMap::get().cloned()`, which caused the original entry to exist
_after_ the move.

I'm not sure why this did not fail much earlier, but it was clearly
wrong. This commit adjust the test to check the "filesystem" before
checking the store and fixes the bug.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-09 17:37:56 +02:00
Matthias Beyer 388632d7ff Fix: Do not pass --rtp in testing environment
As we run tests in-memory (already for a rather long time), we don't
need to pass this anymore.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-09 17:37:56 +02:00
Matthias Beyer 6751c34f1b Fix: Remove call to deprecated function
This actually caused tests to fail if there was indeed a file at
/tmp/store/test and the test tried to create a "test" entry in the store.

Do use backend instead to check whether entry actually exists.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-09 17:37:35 +02:00
Matthias Beyer a0730c0ca9 Roll back mdcat update
Because 0.8 -> 0.10 has changed the API, we cannot update trivially.
Revert the update because of that.
2018-10-06 12:22:15 +02:00
Matthias Beyer 1161562372 Remove handlebars exception in log implementation
The issue was that the handlebars implementation logs as well and if we
use handlebars in the logger implementation that causes recursion which
crashes the program.

With handlebars 1.0.5, there is a feature[0] to disable logging in
handlebars (compiletime) which we use with this patch. The
exception-checking in the log implementation can be removed therefore.

[0]: https://github.com/sunng87/handlebars-rust/pull/236#issuecomment-427014611

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-06 12:22:15 +02:00
Matthias Beyer 5d901ae411 Update dependencies
regex: 0.2 -> 1
semver: 0.8 -> 0.9
2018-10-06 12:22:15 +02:00
Matthias Beyer 5e4779c1f0 Update dependency: filters: 0.2 -> 0.3 2018-10-06 12:22:15 +02:00
Matthias Beyer c7612f156d Update dependency: uuid: 0.6 -> 0.7 2018-10-06 12:22:15 +02:00