Skip to content

Conversation

@trulede
Copy link
Contributor

@trulede trulede commented Feb 1, 2026

If a source (or generate) glob is a templated variable, and that variable is/was an array, then add that array of globs. The following example demonstrates.

Fixes #1018
Also fixes #2400

version: '3'

method: none

vars:
  GLOB_SINGLE: 'foo.*'
  GLOB_ARRAY: ['*.txt', '*.yml'] 
  GLOB_STRING: '*.txt:*.yml' 
  GLOB_SPLIT: '{{splitList ":" .GLOB_STRING}}'

tasks:
  default:
    cmds:
      - cmd: touch foo.txt
      - cmd: touch bar.txt
      - cmd: touch foo.yml
      - cmd: touch bar.yml
      - task: direct
      - task: single
      - task: array
      - task: string
      - task: split

  direct:
    sources:
      - '*.txt'
    cmds:
      - echo "== {{.TASK}} =="
      - for: sources 
        cmd: echo {{.ITEM}}
  single:
    sources:
      - '{{.GLOB_SINGLE}}'
    cmds:
      - echo "== {{.TASK}} =="
      - for: sources 
        cmd: echo {{.ITEM}}
  array:
    sources:
      - '{{.GLOB_ARRAY}}'
      - exclude: Taskfile.yml
    cmds:
      - echo "== {{.TASK}} =="
      - for: sources 
        cmd: echo {{.ITEM}}
  string:
    sources:
      - '{{splitList ":" .GLOB_STRING}}'
      - exclude: Taskfile.yml
    cmds:
      - echo "== {{.TASK}} =="
      - for: sources 
        cmd: echo {{.ITEM}}
  split:
    sources:
      - '{{.GLOB_SPLIT}}'
      - exclude: Taskfile.yml
    cmds:
      - echo "== {{.TASK}} =="
      - for: sources 
        cmd: echo {{.ITEM}}

@timrulebosch
Copy link

It might be worthwhile combining changes from #2624 including/extending test coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants