Functions in replacement syntax
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 168
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
We currently support replacement syntax like GitHub actions via ${{ }} which currently is only supported in ENV, but could be extended to further strings.
This replacement syntax currently only supports a single uppercase expression of another ENV var to replace into the string.
The proposal would be to extend the replacement system to support functions - someFunction(...) with comma-separated arguments, including strings and literals.
For example:
[env]
NAME = "${{ readFile('name.txt') }}"
would set an environment variable from the contents of a file.
Common configuration formats could also be supported:
[env]
VERSION = "${{ json('package.json', 'version') }}"
would set the VERSION environment variable to the contents of the package.json "version" field.
There would be no participation in the task graph, so one would still need to add these files into the task graph normally.
Alternatively we could automatically treat any file dependencies caused by these functions as dependencies of all tasks, just like in theory the chompfile.toml itself should really be. Possibly even exposing this feature separately as a top-level global-deps = ["chompfile.toml"], for dependencies of all tasks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. Start by locating the existing ${{ }} replacement implementation for ENV values, then map the proposed function syntax, argument types, and file-dependency behavior. Done would require an agreed scope and working behavior for examples such as readFile and json, with tests covering parsing and substitution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100