Skip to content

Add preconditions #48

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

Closed

Conversation

scottrigby
Copy link

Signed-off-by: Scott Rigby <[email protected]>
@chris-sanders
Copy link
Member

Neat I didn't know this was a thing. Reading https://taskfile.dev/usage/#using-programmatic-checks-to-cancel-the-execution-of-a-task-and-its-dependencies

It seems that you can provide a message as well. If we're going to add these, adding a message sounds nice. Have you tested this, is there any chance that these run on every step adding unnecessary time to execution or do you know how frequently they are checked?

Part of me think we could add a precondition to the 'default' task so it tells you if you're missing dependencies or add a "check dependencies" task as well. But that might be over optimization if the precondition runs quickly. I know the replciated CLI does not run particularly quickly for me and I would like to avoid running that any more than absolutely necessary.

@scottrigby
Copy link
Author

scottrigby commented Apr 17, 2025

Closing since program requirements will probably be in a container.

If we want to reopen this, things to note are:

  1. the list of Taskfile prerequisites fails at the first non-zero exit code. So if there are multiple missing programs the user is only informed one at a time, which can be a frustrating developer experience
  2. the question came up should we check them all on init before any task. Not sure that's needed since some tasks can be run without the others and therefore don't need all prerequisite programs. Or maybe it would be better DX if we usually want people to run nearly all the tasks?
  3. If not best to check them all before any task, we could at least loop over all programs each task requires in a single prerequisite item for each task, inform the user of all missing programs, then exit 1

@scottrigby scottrigby closed this Apr 17, 2025
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.

2 participants