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

"error: Variable project_name has multiple definitions" when importing justfiles #1827

Closed
sylvorg opened this issue Jan 9, 2024 · 9 comments

Comments

@sylvorg
Copy link

sylvorg commented Jan 9, 2024

Hello!

I am getting the error in the title when trying to import a justfile with the same variable as in the parent file; is there any setting, perhaps similar to allow-duplicate-recipes, that works for variables as well, such as allow-duplicate-variables, maybe?

Thank you kindly for the help!

@casey
Copy link
Owner

casey commented Jan 9, 2024

I'm not sure I understand, can you copy and paste your justfiles so I can take a look?

@sylvorg
Copy link
Author

sylvorg commented Jan 9, 2024

Not at my computer right now, but, it's something like this:

p/a/justfile:

x := `basename {{justfile_directory()}}`

Where x results in a, and:

p/b/justfile:

import "../a/justfile"
x := `basename {{justfile_directory()}}`

Where x is supposed to result in b, but just errors out with what's in the title of the issue.

@casey
Copy link
Owner

casey commented Jan 9, 2024

Gotcha. I think that set allow-duplicate-variables would be reasonable to add, and not too much work.

@casey
Copy link
Owner

casey commented Jan 9, 2024

I marked this as good first issue, in case anyone wants to take a crack at it.

@sylvorg
Copy link
Author

sylvorg commented Jan 9, 2024

Wish I could help, but I know nothing of rust, though I've been wanting to learn it for a while! 😅

@bukowa
Copy link
Contributor

bukowa commented Jul 1, 2024

Can this be closed as completed?

@sylvorg
Copy link
Author

sylvorg commented Jul 1, 2024

I have not tested the changes yet, as I'm working on something else at the moment, unfortunately! 😅 We could possibly reopen it if necessary?

@bukowa
Copy link
Contributor

bukowa commented Jul 2, 2024

I have not tested the changes yet, as I'm working on something else at the moment, unfortunately! 😅 We could possibly reopen it if necessary?

set allow-duplicate-variables := true

I am just using it ^^ I landed here trying to find out why it didn't work before

@sylvorg
Copy link
Author

sylvorg commented Jul 2, 2024

Then we should be good to go, I think! My thanks to everyone involved here! 😸

@sylvorg sylvorg closed this as completed Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants