Skip to content

Specify task sources from dynamic list of files #2483

@bennieswart

Description

@bennieswart

Description

It would be extremely useful to be able to specify the sources of a task from a dynamic list of files.

I'm builing a collection of reusable tasks in a monorepo and many of them accept a list of files to operate on. This list could be from the output of find or ripgrep or something similar. These tasks accept a FILES variable which I'm able to manipulate into the proper format for use in the task command. I'm unable, however, to set the sources of the task based on this variable.

To be clear, the list of files is something like ['file1.txt', 'file2.txt', 'file3.txt']. It is not a pattern, and it is not fixed length.

It seems that setting sources to a dynamic list of files in any intuitive way is impossible.

Intuitive ways that don't work:

a) Setting sources directly equal to a dynamic list:sources: '{{.MY_ARRAY}}'.

b) Expanding individual items of sources into multiple files, similar to how a pattern is expanded.
b.i) By allowing the items to be arrays instead of just strings, similar to (a) but one level deeper.
b.ii) By allowing multiple patterns per item separated by, e.g., newlines or null-bytes.

Currently I'm resorting to building a massive string like {file1.txt,file2.txt,file3.txt} but even with this I'm encountering some annoying corner cases. And honestly at this point things are getting a bit silly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: fingerprintingChanges related to checksums and caching.area: variablesChanges related to variables.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions