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 --unstable --list --unsorted has weird behavior with includes #1742

Closed
neunenak opened this issue Nov 23, 2023 · 1 comment · Fixed by #1745
Closed

just --unstable --list --unsorted has weird behavior with includes #1742

neunenak opened this issue Nov 23, 2023 · 1 comment · Fixed by #1745

Comments

@neunenak
Copy link
Contributor

The code in https://github.com/casey/just/blob/master/src/justfile.rs#L367-L370 that determines what order recipes will be listed in when not sorted alphabetically depends on the offset of a recipe from the beginning of its file.

E.g. if you have the justfiles:

justfile:

# newlines


default:
    echo "DEFAULT"

!include ./include.justfile

include.justfile:

alpha:
    echo "ALPHA"

beta:
    echo "BETA"

Then the output of just --unstable --list --unsorted on latest master is:

Available recipes:
    alpha
    default
    beta

instead of the default - alpha - beta order I'd expect.

#1739 has a solution for this (albeit not a working test), but it also computes the default recipe in a way different than what #1740 decided on, so I'm not sure how much of the code from 1739 is useful.

@casey
Copy link
Owner

casey commented Nov 23, 2023

Maybe the compiler returns a Vec<PathBuf> with the paths of all the source files, in the order in which they were loaded, and then recipes are sorted first by the order in which they appear in that list, and then by order of offset?

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