Runs multiple tasks if they have the same name
If I have a task dev in e.g. package.json & Taskfile.yaml, it will run both.
This is undesirable for me (and I feel like it used to be different?), as I often define tasks in both places, but the Taskfile would e.g. have pnpm install as dependency, and then run the pnpm run dev task (from package.json).
I don't see a clear way to define precedence between the task managers (config file / Env var TK_PREFER_MANAGERS?), but for this to be useful to me it would need something to change :thinking:
It's some some hard to fix this problem, and you can use tk --runner=task hello to task in Taskfile.yaml. I will think about it and find a good solution to fix this problem.
I'd propose:
- a 'sensible' default order, e.g.
- (generic first) Taskfile, justfile, Makefile, Procfile, ..
- (lang-specific) npm, cargo, maven, composer, ...
- (fallback) readme, ..?
- and an environment variable
TASKKEEPER_PRECEDENCE, that can:- give any runner precedence:
task - give multiple runners precedence, while also defining order:
task,just
- give any runner precedence:
- (optional idea)
--allto run tasks of all runners (akin to current behaviour) - (optional idea)
TASKKEEPER_DISFAVOR, that marks runners as "only use if no other one is available" - I'm not sure this is needed (don't see a use-case), but could be an option for later in case it does become neede
How about following flow:
How about following flow
Looks about right... I do agree with putting Readme in the generic category as I've learnt it does require to specifically mark a readme code fence as a task.
One thing I'm a bit unclear about though:
what do you mean by alphabet: a-z ? I don't think the lexical order should have anything to do with selection..?
Also, just in case you were planning to put the diagram in the readme - it doesn't clearly state what happens if neither --all nor --runner are given - the arrow might benefit from a description "Select first by precedence", and positioning the env var descriptions related to that, not next to "all runners" flow - but this does not matter too much imo, just my two cents :tipping_hand_man: