This patch adds a subcommand to imag-timetrack which allows a user to
start a $SHELL and start a timetracking with it and as soon as the shell
exits, the timetracking is stopped.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Beforehand, this command:
imag diary -d foo list | cat
listed each entry twice because the reporting feature of libimagrt
forwarded the list to stdout and the normal output was written to
stderr.
With this patch, we get the output only once in this case.
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>
The implementation of `HabitInstance::get_comment()` was changed and
therefore its semantics were changed.
This patch adapts the call to the function for the new signature and
implications.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch adds a marker in the table when using the "list" command
which marks when the task is already done for the list entry.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch fixes a bug. We stated in the helptext of the "show" command
that when showing several logs, we sort by date. This was not true as we
sorted by Id, which also included the name of the log, hence we
effectively sorted by name.
This patch fixes that. Output is not sorted by date.
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>
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 support in imag-markdown to only list links that are
found in the markdown.
The list format includes the link title, which I consider convenient in
this case, but still easily scriptable.
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>
We should not try to check entries that are not refs because this will
always fail. And because we fail _hard_, the execution of the command
fails on the first non-ref-entry and exits the program. Not good for a
filter... :-)
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch implements a helper in imag-ref to list all dead references
either by store id or by path which is referenced.
Suggested-by: Leon Schürmann <leon@is.currently.online>
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>
The beta compiler reports duplicated input:
error: the item `IntoValues` is imported redundantly
--> lib/entry/libimagentrylink/src/internal.rs:398:13
|
36 | use self::iter::IntoValues;
| ---------------------- the item `IntoValues` is already imported here
...
398 | use internal::iter::IntoValues;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
so we fix this here.
Other imports were fixed as well.
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 the store is more efficient when reading and writing entries to
disk, we do not need to flush the cache anymore.
Hence, remove the flushing.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Finally merging the redefine of the StoreId implementation, which allows
easier handling of StoreId objects.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
imag-header is a tool for querying information of an entry in a defined
format.
imag-header is intended for scripting with imag commands.
The output format is not stable yet, though.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This fixes a bug where a re-import of the contacts directory failed
because some entries already exist.
With this change, one can import the contact directory after things
changed in there and the imag database is updated accordingly, but not
altered. So links and notes are persisting.
For completeness: before, the workflow was to
`cd $IMAG_RTP && git rm store/contacts -r && imag contact import /path/to/contacts`
which is of course not optimal.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Checking whether we have a file (on the FS) here is not enough for
either case (external link/internal link).
Thus, we should check whether a store entry with that ID exists. If it
does, we link internally, else externally by trying to parse the string
as URL.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
The current implementation does not panic on VcardBuilder::build(), so
we unwrap() that directly.
Should be fixed in future versions of either rust-vobject or here, so
that we error appropriately.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This reverts commit a1f0872486995b80216e8a08a2176debdef3752a.
As updating handlebars needs some more involvement, we roll back to the
version we use currently and schedule the update for later.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>