Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command pre/post/task_separator hooks #1327

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

krystian-panek-wttech
Copy link

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-wttech
Copy link
Author

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-wttech krystian-panek-wttech changed the title Command pre/post hooks Command pre/post/task_separator hooks Sep 12, 2023
@krystian-panek-wttech
Copy link
Author

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

@andreynering
Copy link
Member

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.

@krystian-panek-wttech
Copy link
Author

krystian-panek-wttech commented Sep 14, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interleaved output with pre/post tasks
2 participants