mach
mach copied to clipboard
Add support for dynamically matching targets
There is a basis protocol (Target) which exposes match? for whether or not a target matches. A sequential search is then performed over all targets for each input target.
Example usage of this feature:
;; Machfile.edn
{#mach/glob "*.md" {product "somefile"
produce (str "# A title")}}
$ mach hello.md
Writing somefile
Further functionality that is necessary to make this feature useful is the exposure of the match ctx (already assoced onto the target when it matches) so that code can refer to the full path. To extend the example above, the future feature should allow the product to be set based on the matching input.
I haven't thoroughly tested this, so a second pair of eyes over this would be good.
new commit added which dynamically binds vars relative to the match context.