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

Fallback for submodules #2327

Closed
W1M0R opened this issue Aug 28, 2024 · 3 comments · Fixed by #2329
Closed

Fallback for submodules #2327

W1M0R opened this issue Aug 28, 2024 · 3 comments · Fixed by #2329

Comments

@W1M0R
Copy link

W1M0R commented Aug 28, 2024

@casey Thanks for adding submodule support, it's working great.

Currently, when you invoke a submodule recipe within a directory containing a justfile with set fallback but no submodules defined (the requested submodule is defined in a parent justfile), the following error is encountered:

❯ just myapp::start       
error: Justfile does not contain submodule `myapp`

It would be nice if the fallback setting (or another one, e.g. fallback-submodules) would allow just to look for a requested submodule in parent justfiles.

Sometimes you are in a nested folder structure, and you quickly want to call a recipe defined in the root justfile. Since fallback does not work for submodules, the workaround is to add the submodule to the justfile at your level in the hierarchy (even though the recipe you want to run is unrelated to that justfile), or to cd back to the root and run the recipe from there, or to add a recipe in the root justfile that calls into its own submodule definition.

Example

This is what happens currently:

❯ cd proj/foo/bar
❯ just --version    
just 1.34.0
❯ just hello
hello
❯ just myapp::start       
error: Justfile does not contain submodule `myapp`

This is what should happen:

❯ cd proj/foo/bar
❯ just hello
hello
❯ just myapp::start       
starting

proj/justfile

mod myapp 'justfile-myapp.just'
default:
  just --list

proj/justfile-myapp.just

start:
  @echo "starting"

proj/foo/bar/justfile

set fallback
# set fallback-submodules

hello:
  @echo "hello"
@casey
Copy link
Owner

casey commented Aug 28, 2024

Thanks for the report! Fortunately, this was extremely easy to implement. Fixed in #2329.

@casey
Copy link
Owner

casey commented Aug 28, 2024

Available in 1.35.0, just released: https://github.com/casey/just/releases/tag/1.35.0

@W1M0R
Copy link
Author

W1M0R commented Aug 29, 2024

Thanks @casey!

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