'How can I use zsh's zargs with list of commands?

How can I use zsh's zargs with list of commands? I am aware of using something like sh -c but it seems like zsh would be able to do something more efficient.

I thought perhaps an anonymous function like:

zargs -I arg -- **/*.git -- function { cd $1/.. ; git log -1 --format=%cd } arg

but I get

zsh: parse error near `}'

Note: I am also aware I can solve this example with

zargs -I arg -- **/.git -- git -C arg/.. log -1 --format=%cd

but I'm looking for the more general solution.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source