feat: implement a few tera functions for mise toml config #2561
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 implemented these functions:
Since there are difference from
just
, I figure it's good to check in before I continue implementing more and add documentation.PlatformInfo
provides "runtime" information asuname
.just
returnstarget
information. I don't agree on correctness since it will break if you cross-compile. It's always a hassle for package managers. SoPlatformInfo
API provides a different output thanjust
's.I took inspiration from YADM's template design. I provide the result of
arch
,os
, ... as is. This behavior aligns withdirenv
wheredirenv
exposes no arch information. It'sdirenv
's users job to parse platform information. And for mise, users can use tera filter to transform text.What do you think of this?
invocation_directory
is annoying to fix.BASE_CONTEXT
is initialized lazily so I have difficulty testing other functions (I wrote one test per one custom function). We can come back to this later or refactor the context a bit. I prefer skipping inconsistency for now.just
implements functions likekebabcase
as function. I implement them as tera filters. Any objections?Part of #2049