Commit Graph

696 Commits

Author SHA1 Message Date
Matthias Beyer 39d638daee Adapt for new StoreId API
When printing the storepath with the ID (when requested by the user), we
have to ask the store for its path.

This is a rather naive implementation which could be improved by only
checking for a boolean in the last iteration and then use a prepared
variable, rather than making the storepath part of the iterator.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15 20:53:29 +01:00
Matthias Beyer 642702b724 Rewrite: StoreId::new_baseless() -> StoreId::new()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15 20:53:28 +01:00
Matthias Beyer 2611583839 Fix: Also print if runtime ignores IDs
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15 19:13:29 +01:00
Matthias Beyer 86dca4887d Fix negation error
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>
2019-02-11 03:52:04 +01:00
Matthias Beyer 334e9e3954 Add debug output
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11 03:52:04 +01:00
Matthias Beyer fe9409a5dc Do not print table if table is empty anyways
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>
2019-02-11 03:52:04 +01:00
Matthias Beyer 81912ac5cd Add wrapping functionality for imag-log
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>
2019-02-11 03:52:04 +01:00
Matthias Beyer 0ba19daa57 Strip whitespace on the right when printing
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11 03:52:04 +01:00
Matthias Beyer 90eaeb642a Remove magic constants in trace_unwrap_exit/map_err_trace_exit_unwrap calls
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>
2019-02-11 03:52:04 +01:00
Matthias Beyer c8e74193b3 Optimize: Do not attempt to print if output is a pipe
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>
2019-02-11 03:22:56 +01:00
Matthias Beyer f1a639ea8c Change id reporting API to return ExitCode
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>
2019-02-11 03:22:56 +01:00
Matthias Beyer 03e0864268 Merge branch 'unnamed-annotations' into master-ff
This merge adds several patches to improve libimagannotation and
imag-annotate.
2019-02-10 17:07:35 +01:00
Matthias Beyer 53022443ab Rewrite iteration
This patch rewrites how imag-annotate iterates over the ids to process
to be more easily to understand.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-10 01:00:38 +01:00
Matthias Beyer d8cd10a384 Remove iterator types
With this patch, libimagentryannotation does not have special iterator
types anymore. This makes the whole thing more comfortable to use.

In imag-annotate, the parameter for the functioncall was removed.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-10 01:00:33 +01:00
Matthias Beyer c84258da3d Add flag to not print name of annotation
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-10 00:58:21 +01:00
Matthias Beyer ab5078f111 Rewrite "add annotation" command
Because before we created a new annotation for each ID to be annotated,
which is not the expected behaviour.

Now we create one annotation object and then link it to all IDs which
are provided on the commandline.

Also, the annotation name is printed.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-10 00:58:21 +01:00
Matthias Beyer 0f32471a03 Merge branch 'runtime-io-features' into master-ff 2019-02-09 23:42:09 +01:00
Matthias Beyer 84aef82258 Fix: "status" subcommand might not be present
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>
2019-02-09 01:03:34 +01:00
Matthias Beyer e25cf17a8a Fix: We go to the next month, not to the current one
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>
2019-02-09 01:03:32 +01:00
Matthias Beyer 340dab18f0 Fix: 'start-time' cannot be None
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>
2019-02-09 01:03:32 +01:00
Matthias Beyer e4ef6f0649 Remove log-destination-override features
This removes the feature to be able to override log destinations from
the commandline.

This feature is removed because the --override-config feature from the
runtime already contains this functionality. It is a little more complex
to use, though this is a feature hardly used at all, so I rather go for
less code (less complexity) here than feature bloat.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-05 01:03:39 +01:00
Matthias Beyer 4c0baa58f4 Add argument forwarding for --ignore-ids
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-05 00:59:30 +01:00
Matthias Beyer 9185abcfa5 Update copyright years
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-01-03 18:41:36 +01:00
Matthias Beyer 9fca66aa89 Forbid unsafe code in all crates 2018-11-11 13:05:55 +01:00
Matthias Beyer 4e516ee19d Update version strings
...for the next release, which will be imag 0.10.0!

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-10 11:56:37 +01:00
Matthias Beyer 17d4123898 Update dependencies from git versions to proper versions.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-09 22:14:11 +01:00
Matthias Beyer 35291d68ad Make code more idomatic
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-09 21:48:26 +01:00
Matthias Beyer a2eae99a39 Rewrite debug calls with DebugOption extension 2018-11-09 21:48:26 +01:00
Matthias Beyer c767e6239e Remove unused parameter
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-09 21:48:26 +01:00
Matthias Beyer 8d0ae1058e Make code more functional by more function chaining
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-07 13:51:42 +01:00
Matthias Beyer 07cbecc1ba Make code more functional by more function chaining.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-07 13:51:28 +01:00
Matthias Beyer d8a6e9ca9a Rewrite iteration without collecting inbetween
Because why not?

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-07 12:48:35 +01:00
Matthias Beyer 8e1768b424 Refactor code to be more idomatic
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-07 11:52:31 +01:00
Matthias Beyer 345970d36b Import new dependencies
Because of the changes in the "src/ui.rs" files in the binary
implementations, we have new dependencies we need to import into the
build-script of the "imag" command, so that it can build the
commandline.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 20:35:18 +01:00
Matthias Beyer f6483f54db Add ID reporting in imag-timetrack 2018-11-06 20:35:18 +01:00
Matthias Beyer be56f9fe75 Add ID reporting in imag-mail 2018-11-06 20:35:18 +01:00
Matthias Beyer f20298cbe8 Add ID reporting in imag-store 2018-11-06 20:35:18 +01:00
Matthias Beyer c616a5cfaf Add ID reporting in imag-ref 2018-11-06 20:35:18 +01:00
Matthias Beyer 502cdf5721 Add ID reporting in imag-habit 2018-11-06 20:35:18 +01:00
Matthias Beyer 96ad41ea4c Add ID reporting in imag-mv 2018-11-06 20:35:18 +01:00
Matthias Beyer f3a03efd5d Add ID reporting in imag-wiki
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 20:35:18 +01:00
Matthias Beyer 860c58cbdf Add ID reporting in imag-log 2018-11-06 20:35:18 +01:00
Matthias Beyer eceae358f8 Add ID reporting in imag-notes 2018-11-06 20:35:18 +01:00
Matthias Beyer 2ca6be8322 Add id reporting in imag-diary 2018-11-06 20:35:18 +01:00
Matthias Beyer 8523ae2120 Add id reporting in imag-contact 2018-11-06 20:34:46 +01:00
Matthias Beyer 344aae5f92 Add ID reporting in imag-bookmark 2018-11-06 20:33:30 +01:00
Matthias Beyer 1e6d58bf4c Add ID reporting in imag-view 2018-11-06 20:33:30 +01:00
Matthias Beyer d3400167df Add ID reporting in imag-tag 2018-11-06 20:33:30 +01:00
Matthias Beyer aef969f8bb Add ID reporting in imag-link 2018-11-06 20:33:30 +01:00
Matthias Beyer 4e5315b0e5 Add ID reporting in imag-grep 2018-11-06 20:33:30 +01:00
Matthias Beyer ff809a3750 Add ID reporting in imag-gps 2018-11-06 20:33:30 +01:00
Matthias Beyer 3a6443b3ef Add ID reporting in imag-ids
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 20:33:30 +01:00
Matthias Beyer 274811243f Move imag-view to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer f83d72033f Move imag-tag to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 527e0310ae Move imag-link to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 4856541f5a Move imag-gps to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 70014e04b1 Move imag-ids to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer a805db2a88 Move imag-edit to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 30036d5628 Move imag-category to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 01de94a387 Move imag-annotate to ID provider infrastructure 2018-11-06 20:33:30 +01:00
Matthias Beyer 17913ae3fd Optimize implementation: Less matches
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>
2018-11-06 14:48:49 +01:00
Matthias Beyer 1321f49428 Optimize implementation
Code-wise, the functionality was not changed. The changes only make the
code much more pretty.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 14:48:49 +01:00
Matthias Beyer d004c667fd Optimize implementation
Code-wise, the functionality was not changed. The changes only make the
code much more pretty.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06 14:48:49 +01:00
Matthias Beyer 5210985bf4 Optimize implementation
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>
2018-11-06 14:48:49 +01:00
Matthias Beyer 1347784898 Merge branch 'safe-output'
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-01 21:22:26 +01:00
Matthias Beyer 3bf3a8890b Add debugging output in test via logger 2018-11-01 20:36:46 +01:00
Matthias Beyer 089d5b98cb Use error output from runtime to print error 2018-11-01 20:36:34 +01:00
Matthias Beyer afeb4031ac Use runtime provided error stream
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-01 20:34:58 +01:00
Matthias Beyer 8223f846b4 Use new "ask" function interface with input/output stream params
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>
2018-11-01 20:33:24 +01:00
Matthias Beyer 32f38945f0 Fix tests: Do not pass "internal", subcommand does not exist anymore 2018-11-01 13:15:19 +01:00
Matthias Beyer e39bd7fc72 Merge branch 'fix-flag-forwarding'
Conflicts were handled manually.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-01 00:09:54 +01:00
Matthias Beyer 25ee6f2ce4 Fix: Forward flags as well
This is a bugfix. The old implementation did not forward simple
commandline flags (as in `--debug`, arguments with no value) because it
only used `ArgMatches::value_of()`. But if there is no value, the method
returns `None` and the flag is not forwarded.

This patch fixes that issue.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-31 23:12:35 +01:00
Matthias Beyer c4c52e43a6 Add some debugging output 2018-10-31 23:11:06 +01:00
Matthias Beyer e4ffeddf85 Use libimagrt logging
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-31 23:10:26 +01:00
Matthias Beyer 21927d4225 imag build script: Update available commands 2018-10-31 17:15:29 +01:00
Matthias Beyer aff5059652 imag-todo: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 5821a55c14 imag-mail: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer fd2367b849 imag-timetrack: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer d7eda6c451 imag-log: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 62eb711409 imag-wiki: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 1362a3f9ea imag-bookmark: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 3ac30c0944 imag-contact: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 4486abed84 imag-diary: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 8fb35b5fe1 imag-habit: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer c1bc5d4bf6 imag-view: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 73362c6de3 imag-link: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 11abf55a0f imag-annotate: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 6d8bac314c imag-tag: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer e3911d97d9 imag-store: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 3272dbfd74 imag-mv: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 8114c5976c imag-diagnostics: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 279751b99c imag-ids: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 3cfe5f217c imag-gps: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 12644f22d9 imag-category: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 79b996f0ad imag: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30 18:46:29 +01:00
Matthias Beyer 52c5300ec8 Update about-text in imag-wiki
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-17 11:37:24 +02:00
Matthias Beyer f970fc987f Update about-text in imag-tag
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-17 11:37:24 +02:00
Matthias Beyer 5b4715b311 Update about-text in imag-link
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-17 11:37:24 +02:00
Matthias Beyer 0d103653ea Update about-text in imag-ids
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-17 11:37:24 +02:00
Matthias Beyer 325c5ddbd0 Fix: URL in imag helptext
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-17 11:37:24 +02:00