summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-habit/src
AgeCommit message (Collapse)Author
2020-03-08Replace failure with anyhow in complete codebaseMatthias Beyer
This patch was scripted with sed -i 's/use failure::Error/use anyhow::Error/' $(rg "use failure::Error" -l) sed -i 's/use failure::Fallible as /use anyhow::/' $(rg "use failure::Fallible" -l) sed -i 's/failure/anyhow/' $(rg "failure *=" -l) sed -i 's/format_err!/anyhow!/' $(rg "format_err!" -l) sed -i 's/use failure::ResultExt/use anyhow::Context/' $(rg "use failure::ResultExt" -l) sed -i 's/err_msg/anyhow!/' $(rg "use failure::err_msg" -l) sed -i 's/^anyhow\ *=.*$/anyhow = "1"/' $(rg "anyhow * =" -l) sed -i 's/^anyhow_derive.*//' $(rg "anyhow_derive" -l) sed -i 's/extern crate failure/extern crate anyhow/' $(rg "extern crate failure" -l) sed -i 's/.*extern crate anyhow_derive.*//' $(rg "anyhow_derive" -l) Some manual changes were added as well, so this patch was not completely scripted, but mostly. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-01-01Update copyright years to 2015-2020Matthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-24Fix: Drop habit before getting instancesMatthias Beyer
Because when showing an instance, we try to get the comment for the instance from the habit template, which tries to Store::get() the template in HabitInstance::get_comment(). This fails if the template is already borrowed, thus drop the borrow before the whole thing. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Remove len() != 0 comparison with negation and ::is_empty() callMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Remove unnecessary return keywordMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Remove DebugResult and DebugOption helpersMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Replace map_dbg() and map_dbg_str() with context() and inspect() callsMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-21Rewrite imag-habit to propagate errors to main() instead of exit()ingMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26imag-habit: implement ImagApplicationLeon Schuermann
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-08-28[No-auto] bin/domain/habit: Fix Clippy warningsflip1995
Signed-off-by: flip1995 <hello@philkrones.com> Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28[Auto] bin/core/habit: Fix Clippy warningsflip1995
Signed-off-by: flip1995 <hello@philkrones.com> Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-06-30Merge branch 'libimaghabit-dont-copy-comment-to-instance' into masterMatthias Beyer
2019-06-30Adapt imag-habit impl for `HabitInstance::get_comment()`Matthias Beyer
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>
2019-06-30Add "done" marker in "list" outputMatthias Beyer
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>
2019-02-11Fix negation errorMatthias Beyer
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-11Add debug outputMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Remove magic constants in trace_unwrap_exit/map_err_trace_exit_unwrap callsMatthias Beyer
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-11Change id reporting API to return ExitCodeMatthias Beyer
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-09Fix: "status" subcommand might not be presentMatthias Beyer
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-01-03Update copyright yearsMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-11Forbid unsafe code in all cratesMatthias Beyer
2018-11-09Make code more idomaticMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06Add ID reporting in imag-habitMatthias Beyer
2018-11-06Optimize implementation: Less matchesMatthias Beyer
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-01Use new "ask" function interface with input/output stream paramsMatthias Beyer
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-10-30imag-habit: Move from error-chain to failureMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-06Update dependency: prettytable: 0.6 -> 0.8Matthias Beyer
2018-06-27Fix: Use unused resultMatthias Beyer
2018-05-01Refactor imag-habit to new store iterator interfaceMatthias Beyer
2018-04-04Handle unknown subcommands in binaries with Runtime::handle_unknown_subcommandMatthias Beyer
2018-03-22Use variable mutable, so we can create an instanceMatthias Beyer
2018-03-22Add parameter to show done habitsMatthias Beyer
2018-03-04Use output stream from Runtime::stdout()Matthias Beyer
2018-02-20Remove usage of libimagentrylistMatthias Beyer
2018-02-19Fix for broken pipe panicsMatthias Beyer
2018-02-18Add debug output what is about to be doneMatthias Beyer
2018-02-13Use new make_imag_version!() macro for building version stringMatthias Beyer
2018-02-10Do not print "Ok" after successful executionMatthias Beyer
2018-02-07Update dates in license headerMatthias Beyer
And add missing header in one file
2018-02-01Move date <-> string conversion utility to libimagutilMatthias Beyer
2018-01-12Remove dependency "version"Matthias Beyer
Because the "version" crate is licensed as GPL, which would us require to release imag as GPL, we remove the crate now.
2017-12-22Change UI. Positional args are not possible hereMatthias Beyer
2017-12-22Add functionality so we can create a habit with a due dateMatthias Beyer
2017-12-22Adapt for new API of Habit::next_instance_date()Matthias Beyer
With cd8f0beae864c06f02b0d43fe4b63a0ba580229a the interface of `HabitTemplate::next_instance_date()` changed to return a `Result<Option<_>>` rather than a `Result<_>` because the next_instance_date could be a None if the Habit was closed already. This patch adapts imag-habit for this new interface.
2017-12-22Add more output in today()Matthias Beyer
2017-12-22Add future-check in CLI and fix for default command invokationMatthias Beyer
2017-12-22Add more details to default commandMatthias Beyer
2017-12-22Add `done` functionalityMatthias Beyer
2017-12-22Impl delete()Matthias Beyer
2017-12-22Explicitely state that printing an empty table is forbiddenMatthias Beyer