Skip to content

RFE: Allow use of wildcard or regex in task names (dynamic task names) #836

@ssbarnea

Description

@ssbarnea

In order enable taskfile to a viable replacement for some more specialized test runners, such tox or nox, we need to allow it to accept task names that are using a pattern (regex or glob), so users would not have to copy/paste task definitions when creating test-matrixes.

A very easy to explain example is that tox accepts tasknames like py, py36, py311 without forcing user to explicitly define each value. The idea is that the variadic part of the name ends-up as being processed as a variable.

In fact its support for this goes even deeper allowing you to use multiple dimensions and have tasks like: py36-func, py36-unit`, all without having to define an endless list of combinations.

While supporting multiple dimensions might be seen maybe as too much for taskfile, maybe we should at least allow user to define a taskname like foo* and ensure that the effective taskname is available inside a variable. That should allow someone to process the name and infer the matrix variables to use for it, or give an error message if the arguments are not valid.

While the glob version (py*) would be easier to implement, the regex would be more flexible as it would allow to validate the task name and even document allowed inputs, like py(\d+)\-((unit|func)). Using capture groups we can also extract the dimensions, if using named capturing groups we could even determine in which variables we could save them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions