copier icon indicating copy to clipboard operation
copier copied to clipboard

Make task execution optional

Open azatoth opened this issue 8 months ago • 1 comments

Actual Situation

Currently I have a template to setup AWS CDK templates and I setup a task to run bootstrap on the new environment. But as I usually only want to run bootstrap once, or when certain things has changed in the template, I've resorted in having the tasks commented out fully.

Desired Situation

I would like to instead of a --tasks flag that is required to be set in order to run copier at all, I would like instead something like this: --enable-task taskId for copy, and additional add a separate command run-task <taskId> to only run the task

Proposed solution

No response

azatoth avatar Mar 20 '25 09:03 azatoth

Could you put this logic in your tasks, so they are always executed but their behavior is conditional as you described? To force a certain task action, you could, e.g., use custom environment variables like FORCE_ACTION=bootstrap(totally up to you how to design this) when you run a Copier command. For example:

env FORCE_ACTION=bootstrap copier copy ...

If we make tasks optional, then we reduce automation by requiring users to decide when and when not to execute tasks. WDYT?

sisp avatar Apr 17 '25 14:04 sisp