-
-
Notifications
You must be signed in to change notification settings - Fork 574
fix(task): allow args to be used with tera tests #4605
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Depending on jdx/usage#252, as |
jdx
pushed a commit
that referenced
this pull request
Mar 21, 2025
### 🐛 Bug Fixes - **(node)** skip gpg verification of sig file not found by [@jdx](https://github.com/jdx) in [#4663](#4663) - **(task)** allow args to be used with tera tests by [@risu729](https://github.com/risu729) in [#4605](#4605) - Fix syntax error on `activate nu` when PATH contains shims by [@atty303](https://github.com/atty303) in [#4349](#4349) ### 🚜 Refactor - **(registry)** use ubi for yamlscript by [@scop](https://github.com/scop) in [#4670](#4670) ### 📚 Documentation - Fix typo in java.md by [@hverlin](https://github.com/hverlin) in [#4672](#4672) ###◀️ Revert - "chore: temporarily disable bootstrap test" by [@jdx](https://github.com/jdx) in [#4658](#4658) ### 📦️ Dependency Updates - update rust crate ctor to 0.4 by [@renovate[bot]](https://github.com/renovate[bot]) in [#4553](#4553) ### Chore - **(registry)** declare copier by [@looztra](https://github.com/looztra) in [#4669](#4669) - Update to the latest version of ubi by [@autarch](https://github.com/autarch) in [#4648](#4648) - bump expr by [@jdx](https://github.com/jdx) in [#4666](#4666) - added android-sdk by [@jdx](https://github.com/jdx) in [#4668](#4668) - rename mise-php to asdf-php by [@jdx](https://github.com/jdx) in [#4674](#4674) ### New Contributors - @atty303 made their first contribution in [#4349](#4349) - @looztra made their first contribution in [#4669](#4669)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR enables the use of
arg
,option
, andflag
in task templates withinif
conditions or similar syntaxes.Current Behavior
Currently, placeholders are replaced only after the Tera template is fully rendered. So, expressions like the following:
would incorrectly render
mise test --test
as justecho
because'MISE_TASK_ARG:test:MISE_TASK_ARG' != 'true'
.Changes
Since we need to parse the usage spec before rendering the full Tera template, this PR adds the second rendering after the usage spec is processed. This ensures that expressions with nest like this are evaluated correctly.
Re-rendering the template might introduce some performance overhead, but I believe it's the simplest solution for this.
Of course, templates with more nests cannot be parsed correctly, but it is impossible if we are using usage to parse args in the template.
I still need to fix this PR to avoid code duplication and handle escapes, but I’d like to hear your thoughts on this approach.Apologies for creating a PR directly. I was debugging locally and wanted to share the idea.