Replies: 1 comment
-
Why stop there, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi and great job!
Apologies if this idea has already been proposed. I looked for it but I could not find any similar reference.
Would it be possible to have a special kind of task that always runs once before all other tasks in the the same taskfile, meaning without being explicitly called or stated as dependency? Similar to what happens with unit-testing frameworks
beforAllClass()
Example:
In the example above,
before-all
is like any other task except that it is labelled asrun: once_before
meaning that this will always run once each time one or more tasks in the same file are invoked:I understand there are ways to achieve this but AFAIK, they lead to a lot more code: constant explicit dependencies, convoluted global dynamic vars.
A valid constrain could be that only one task per taskfile can be labelled as
run: before_all
Obviously this may pave that way for other similar semantics:
before_any
,after_all
,after_any
.Why this can be useful? Simplifying taskfile development, better standalone taskfiles, concentrating all checks in a single place so to enforce system-wide preconditions without duplicating code.
Happy to discuss more if you think this is useful/doable.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions