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

Included and aliased Taskfiles don't play well with wildcards #1900

Open
JackoCoolio opened this issue Nov 2, 2024 · 1 comment
Open

Included and aliased Taskfiles don't play well with wildcards #1900

JackoCoolio opened this issue Nov 2, 2024 · 1 comment
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@JackoCoolio
Copy link

Including a Taskfile with wildcard tasks and aliasing it doesn't work.

Taskfile.yml:

version: '3'

includes:
  included:
    taskfile: Taskfile2.yml
    aliases: [inc]

tasks:
  foo-*:
    cmds:
      - "echo bar: {{index .MATCH 0}}"
    aliases: [f]

Taskfile2.yml

version: '3'

tasks:
  bar-*:
    cmds:
      - "echo bar: {{index .MATCH 0}}"

Output of task --list-all:

task: Available tasks for this project:
* foo-*:                      (aliases: f)
* included:bar-*:             (aliases: inc:bar-*)

That's pretty misleading, though, because trying some of the implied commands results in:

# f is a wildcard task, so it should take parameters
$ task f-hello
task: Task "f-hello" does not exist

# okay, let's just do what it says in "(aliases: f)"
$ task f
template: :1:12: executing "" at <index .MATCH 0>: error calling index: index of untyped nil

# that was even worse; what about bar in our included Taskfile?
$ task inc:bar-hello
task: Task "inc:bar-hello" does not exist
  • Task version: 3.38.0
  • Operating system: x86_64-pc-linux-gnu
  • Experiments enabled: N/A
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Nov 2, 2024
@JackoCoolio
Copy link
Author

I'm working on a fix for this, but figured I'd add an issue in the meantime :)

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

No branches or pull requests

2 participants