Skip to content
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

just --list --unsorted deals with imports in reverse order. #2076

Closed
gl-yziquel opened this issue May 23, 2024 · 9 comments · Fixed by #2085
Closed

just --list --unsorted deals with imports in reverse order. #2076

gl-yziquel opened this issue May 23, 2024 · 9 comments · Fixed by #2085

Comments

@gl-yziquel
Copy link
Contributor

Hi.

Just noticed the following: whereas just --list --unsorted lists the recipes in the order in which they are defined in the Justfile, it lists the recipes in the imported Justfiles in the reverse order in which the Justfiles are imported.

This is hugely counterintuitive.

@casey
Copy link
Owner

casey commented May 25, 2024

Fixed in #2085. Thank you for the report!

@gl-yziquel
Copy link
Contributor Author

You're most welcome. Now, I'll have to reverse all my imports...

@gl-yziquel
Copy link
Contributor Author

Hmmmh. I just built 1.27.0 (which is where I see the puported fix in the git history). And I still see the buggy behaviour.

Justfile:

import "task1.just"
import "task2.just"

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

task1.just:

task1:
    echo Task 1

task2.just:

task2:
    echo Task 2

When running just, I get:

Available recipes:
    task2
    task1

Wrong ordering.

I don't see it fixed.

@casey
Copy link
Owner

casey commented May 25, 2024

Sigh, I fixed it for modules, not imports 😅

@casey casey reopened this May 25, 2024
@casey
Copy link
Owner

casey commented May 26, 2024

Fixed in #2092!

@casey casey closed this as completed May 26, 2024
@gl-yziquel
Copy link
Contributor Author

Yes. Much better. However, if you allow me to be a pain, here is another related behaviour, which I'm not sure will be most easy to address:

Justfile:

import "task1.just"
import "task2.just"

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

task3:
    echo Task 3

That will render as follows:

Available recipes:
    task3
    task1
    task2

Not sure how easy that behaviour will be to fix. Should I open another issue ?

@casey
Copy link
Owner

casey commented May 26, 2024

Hmmm, the current behavior is that recipes in the current module are printed first, then recipes from imports, which are printed first by the order of the import in the top file, and then in the order they appear in the import.

I can see the argument for printing them, in the case of your example, in task1 task2 task3 order. Why don't you open an issue and we can get some user feedback?

@gl-yziquel
Copy link
Contributor Author

gl-yziquel commented May 26, 2024

OK.

Discussion ? Or issue ?

I assume discussion.

Here: https://github.com/casey/just/discussions/2095

@gl-yziquel
Copy link
Contributor Author

@casey Wow !! Modules are pretty impressive !! Thank you so much !!

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 a pull request may close this issue.

2 participants