Introduces a range of and_then
and after
function that will handle callbacks
#68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Builds on top of your previous work for
and_then
. We might also wanna changechain
i my opinion it has the even better interface to do that.None of these additions are necessary but after i saw @tami5 code it might be helpful. tami is currently in the
on_exit
callback hell which makes maintaining his work a nightmare, no offense tami :). This might help writing jobs that go from job to job easier.Example at the end. For me that is easier to read and i actually know when which job does what and what the conditions are for that case to happen. Does this make sense? We do not need to integrate it :)
I only want that
sync
returns the result code. Thats the only thing that interests me tbh 🤣 Saves me one line in telescope.Adds:
sync
will now returncode
as second return valueand_then(job)
: will always run joband_then_wrap(job)
: will always run job (schedule_wrapped)and_then_on_success(job)
: will only run job if code == 0and_then_on_success_wrap(job)
: will only run job if code == 0 (schedule_wrapped)and_then_on_failure(job)
: will only run job if code ~= 0and_then_on_failure_wrap(job)
: will only run job if code ~= 0 (schedule_wrapped)after(fn)
: will always run functionafter_success(fn)
: will only run function if code == 0after_failure(fn)
: will only run function if code ~= 0Example: