task
task copied to clipboard
Command pre/post/task_separator hooks
fixes #1013
before change:
adding such snippet:
cmds:
pre: echo ""
will make it look like this: (output nicely grouped even when output style is interleaved)
using an output style 'group' with end "\n" does not make sense to me because then I need to wait for the long-running task (even 10 minutes) to see the grouped output. this solves my problem as I have still dynamically printed output and it is grouped nicely by this pre cmd hook printing empty line exactly as I desired.
this extension does not work perfectly as I wanted. Ideally, the pre/post hooks are executed in the beginning and end of task execution but... after a deep dive into Task implementation, I see that tasks are executed by recursion which makes it really hard to print these new lines correctly... for example the hooks could be called in a following order: pre pre, pre end pre end end end. As an effect then I will see doubled new lines in between task command outputs... :/
OK I achieved the desired effect, please validate :) I even tried providing a long vertical line as a task separator to indicate the purpose of a new option; now tasks outputs could be easily grouped in console by leveraging that task separator
Hi @krystian-panek-wttech,
I'm not convinced to add this to the code base. This seems to be more complex than worth it to just have a better log formatting.
If you think we could improve the formatting, like having like breaks, we could consider doing that directly on Task without the need of hooks.
I am ok with doing that without hooks. My main case is to add separators before and after executing tasks with an interleaved output style. If you have an idea how to implement it differently I would be interested.