Implemented 'set allow-duplicate-variables' #1922
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ran into the same issue as #1827 and decided to make a quick draft for it.
It's my first rodeo with rust (and I am not a big fan so far, but it may grow onto me), so I appreciate feedback.
This issue allows us to overwrite assignments, even when they are imported from other justfiles. Previously it would have thrown an error. We now can use
set allow-duplicate-variables
to enable this behavior (in the same style as the existingset allow-duplicate-recipes
).Example: Default behavior
Example: Using the flag to overwrite a variable
Example: Using the flag in an import
Feedback appreciated
I am not quite happy with the detour I had to take with
DepthAwareBinding
. I introduced it because the assignments need to be aware of their depth, otherwise imported modules would overwrite assignments that appear later in the justfile. As I did not use rust before, I do not know the best practices for this in this language and just wanted to get the draft done (for now).Some other thing
I ran into
just
just (hehe) a few months ago - and fell in love. Thanks for this tool!