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

[Feature] Support globbing with includes directive #1641

Open
th3fallen opened this issue Jul 11, 2023 · 2 comments
Open

[Feature] Support globbing with includes directive #1641

th3fallen opened this issue Jul 11, 2023 · 2 comments

Comments

@th3fallen
Copy link

It would be amazing to be able to do !include path/to/my/subjusts/*.just and move on with life vs including each seperately.

@IrrationalPi
Copy link

I would love this feature also. I used it a lot with make to divide makefiles into like functionality.

Here is a workaround. The update recipe will scan a folder for all *.just files, format them, create a temporary Justfile with all the !include directives, then dump them to a single Justfile. I have found !include to be too buggy for daily use in the primary Justfile.

Initial Justfile:
!include ./justfiles/self.just

./justfiles/self.just:

justfile_dir := "./justfiles"

update:
    #!/usr/bin/env bash
    set -euxo pipefail
    cp Justfile Justfile.bak
    echo "# DO NOT EDIT. Auto-generated. Update with 'just update'." > Justfile.includes
    for file in {{ justfile_dir }}/*.just; do
        echo "!include ${file}" >> Justfile.includes
        just --justfile "${file}" --fmt --unstable || true
    done
    just --unstable --justfile Justfile.includes --dump > Justfile
    rm Justfile.includes

After making any changes to a *.just file in your watched folder, run:
just update

@casey
Copy link
Owner

casey commented Jan 15, 2024

This seems reasonable. include has been stabilized as import, so this wouldn't technically be backwards compatible, but I think that * in paths is so vanishingly rare that we can go ahead and do it.

neunenak added a commit to neunenak/just that referenced this issue Sep 17, 2024
neunenak added a commit to neunenak/just that referenced this issue Sep 19, 2024
neunenak added a commit to neunenak/just that referenced this issue Sep 25, 2024
neunenak added a commit to neunenak/just that referenced this issue Oct 2, 2024
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

No branches or pull requests

3 participants