just icon indicating copy to clipboard operation
just copied to clipboard

Ordering of tasks from main Justfile and from imports.

Open casey opened this issue 1 year ago • 6 comments

Originally posted by gl-yziquel May 26, 2024 Hi.

I've got a use case that seems to go counter to current Just behavious, and, as suggested on a bug report discussion, I (or we) would welcome user feedback. So please share your thoughts.

Original bug report: https://github.com/casey/just/issues/2076

I want to be able to control the listing of tasks, with just --list --unsorted. And would like to be able to do the following:

import "task1.just"

task2:
    echo Task 2

import "task3.just"

task3:
    echo Task 4

[private]
@help:
    just --list --unsorted --justfile "{{ justfile() }}"

I would like the output of just help to be as follows:

Available recipes:
    task1
    task2
    task3
    task4

That would allow me to control precisely the ordering of the display of just recipes.

Currently, the behaviour of Just is to render the recipes of the current Justfile first, and the imports later. Like that

Available recipes:
    task1
    task3
    task2
    task4

As my use case would require a "breaking" change of current behaviour, user feedback would be appreciated.

casey avatar May 26 '24 09:05 casey

@gl-yziquel converted this to an issue, since I tend to lose track of discussions.

casey avatar May 26 '24 09:05 casey

I definitely like the idea that import "justfile" behaves as much as possible as if you had taken the contents of the imported justfile and pasted them into the current file at exactly the line where the import appears. That would imply that just should list recipes in the first rather than the second order.

neunenak avatar May 26 '24 09:05 neunenak

@neunenak Thank you.

gl-yziquel avatar May 26 '24 11:05 gl-yziquel

@casey I believe this issue may now be closed. No ?

gl-yziquel avatar Sep 12 '24 09:09 gl-yziquel

Yah, I think this was implemented. Thanks for the ping!

casey avatar Sep 13 '24 07:09 casey

I just tried this with just 1.40.0, and this issue, if it ever was solved (I beieve it was), has crept back.

I'd like to reopen it.

gl-yziquel avatar Mar 17 '25 15:03 gl-yziquel