Skip to content
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

Unable to use Requires to limit Wildcards #1955

Open
ionfury opened this issue Dec 13, 2024 · 0 comments · May be fixed by #1960
Open

Unable to use Requires to limit Wildcards #1955

ionfury opened this issue Dec 13, 2024 · 0 comments · May be fixed by #1960
Assignees
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@ionfury
Copy link

ionfury commented Dec 13, 2024

From the docs I expect to be able to use requires and wildcard arguments together to limit the possible wildcards. Below is an example, following from the initial wildcard PR #1489:

---
version: "3"

tasks:
  start-*:
    desc: "Starts a service.  Options: web, db"
    vars:
      SERVICE: "{{ index .MATCH 0 }}"
    cmds:
      - echo "Starting {{.SERVICE}}"
    requires:
      vars:
        - name: SERVICE
          enum: ["web", "db"]

And the output:

❯ task start-a
task: Task "start-*" cancelled because it is missing required variables: SERVICE
❯ task start-web
task: Task "start-*" cancelled because it is missing required variables: SERVICE

Removing the requires block results in the following (correct) output:

❯ task start-web
task: [start-*] echo "Starting web"
Starting web

I would expect requires to validate that SERVICE is in ["web", "db"]. If this assumption or my implementation is incorrect, please forgive me.

  • Task version:
Task version: 3.40.1 ()
  • Operating system:
ProductName:            macOS
ProductVersion:         14.4.1
BuildVersion:           23E224
  • Experiments enabled: none
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Dec 13, 2024
@vmaerten vmaerten linked a pull request Dec 15, 2024 that will close this issue
@vmaerten vmaerten linked a pull request Dec 15, 2024 that will close this issue
@vmaerten vmaerten self-assigned this Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants