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

default target must be declared first which gives problems with !include #1557

Open
peterhoeg opened this issue Feb 28, 2023 · 4 comments
Open

Comments

@peterhoeg
Copy link

just will default to the first target/recipe, so if default isn't the first, it's ignored:

$ cat justfile

a:
  echo 'AAA'

b:
  echo 'BBB'

default: b
$ just
echo 'AAA'
AAA

When combined with !include which has to come before anything, you will need to do the following:

!include default.just
!include some/other/file.just

And then set the default target in default.just in order to be able to define a default target.

@indigoviolet
Copy link

Justfiles are insensitive to order. You can do default: b before defining b

@peterhoeg
Copy link
Author

peterhoeg commented Mar 8, 2023 via email

@neunenak
Copy link
Contributor

I think the correct long-term solution is to remove the limitation on where !include directives can exist in a justfile, so that you can define a default recipe in a file and then have your includes come after it. This will require some changes to the parser and the internal representation of the justfile, but that seems like it's worth doing - this limitation is actually pretty annoying.

@peterhoeg
Copy link
Author

There's really 2 issues here:

  1. !include has to come first, and
  2. default must be defined before any target

You could solve 2 without solving 1. Of course, ideally both get fixed! ;-)

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