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>
When installing (a subcrate) from crates.io, it fails because it cannot
find the buildscript. This is the quickfix, simply remove the
buildscript itself and the setup of the buildscript in all Cargo.toml
files.
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>
This patch adds the -d / --show-duration feature to the "list"
subcommand, which makes imag-timetrack list the duration of the
timetracking in the output.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch adds a imag-contact feature where we loop as long as we
cannot parse the vcard. If the `--no-retry` flag is passed, we fail immediately.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch adds the option to force-override the ref data in the
imported entries. This is necessary when importing contact data which is
already in the store, but where the reference data has changed (for
example if the hash of the file has changed, this might come in handy at
some point).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch rewrites the imag-contact binary to be able to work with the
new libimagcontact interface, which now uses libimagentryref for storing
references to the actual vcard files.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
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>