task icon indicating copy to clipboard operation
task copied to clipboard

Command pre/post/task_separator hooks

Open krystian-panek-vmltech opened this issue 1 year ago • 4 comments

fixes #1013

before change:

image

adding such snippet:

cmds:
  pre: echo ""

will make it look like this: (output nicely grouped even when output style is interleaved)

image

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.

krystian-panek-vmltech avatar Sep 12 '23 19:09 krystian-panek-vmltech

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... :/

krystian-panek-vmltech avatar Sep 12 '23 21:09 krystian-panek-vmltech

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

image

krystian-panek-vmltech avatar Sep 12 '23 21:09 krystian-panek-vmltech

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.

andreynering avatar Sep 14 '23 00:09 andreynering

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.

krystian-panek-vmltech avatar Sep 14 '23 19:09 krystian-panek-vmltech