Foreach doesn't work with groups.
Hello,
It seems that groups aren't expanded in rule input, so rules like:
: foreach %<group> |> mv %f %o |> %B
and
: foreach <group> |> mv %f %o |> %B
doesn't work.
(I'm trying to workaround issue #220 )
Greetings.
Edit: It works for {bins}.
You don't need foreach. You also have to expand the group using %<group> instead of %f inside the command.
Try:
: <group> |> mv %<group> %o |> %B
See the %<group> section of the manual: http://gittup.org/tup/manual.html
As I understand, this doesn't actually solve the OP's problem though, does it? It appears they want to do:
mv foo.c foo
mv bar.c bar
mv baz.c baz
The rule suggested by @kavika13 wouldn't even compile, because tup expands the %<group> in place, trying to create something like mv foo.c bar.c baz.c .... As a result, %B won't work at all because the input is a list of files, therefore %o won't expand either and tup will complain.
Using {bin} is also a limited solution because it only works for the current directory. What if you want to individually operate on the members of this group in a parent directory rather than in place?
Yep, my bad. For the mv command, that type of group expansion would not work.