magefile / mage

a Make/rake-like dev tool using Go

Home Page:https://magefile.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhancement: glob targets

flowchartsman opened this issue · comments

Describe the feature
I think it would be really nifty to be able to use mage in a make-like way with globs. Note: this is perhaps an alternative or enhancement to #340, which would also enable this sort of thing, albeit with a requisite target.

What problem does this feature address?
I am writing a book using asciidoc, and I have targets for generating PDFs for pre-pub and editing. I would like to be able to generate ALL pdfs (target pdfs) or just one at a time mage manuscript/chapter07.pdf. Currently this isn't possible I don't think, however you could provide a way to mark a function (either exported or not) as accepting a certain glob. Maybe something like this:

func Pdfs() error {
  // get all files
  return pdf(allfiles...)
}

func pdf(fileTargets ...string) error {
  for _, ft := range fileTargets {
    //...
  }
}

mg.Globs(pdf, "manuscript/*.pdf)