Garry Heaton wrote:
but if I limit myself to a subdirectory with:

./go.sh about/*

Hi Garry,

That's because the shell is pre-expanding about/* into a list of files.

  ./go about/one about/two about/three ...etc..

If you specify a list of files on the ttree command line like that then
it assumes you know what you're doing and really want them processed
regardless of any accept/ignore rules.

Unfortunately those factors conspires to make it Do The Wrong Thing :-(

What would be nice for ttree is for it to recognise wildcard patterns
and Do The Right Thing, effectively adding an extra accept="about/*"
rule to the existing accept/ignore rules.  You would have to quote the
wildcard to stop the shell from expanding it, but that wouldn't be too
bad.

  ./go 'about/*'

Thinking about it, you *should* already be able to do this:

  ./go --accept='about/'

to get the desired effect.

However, that doesn't seem to work.  Looking at the code for ttree,
the --ignore option matches against directory paths whereas the
--accept option matches against file names.  That seems broken to
me.

[tap...tappety...tap]

Yes, it appears to be a bug in ttree.  A four letter bug, to be precise.

--- ttree       (revision 1068)
+++ ttree       (working copy)
@@ -370,7 +370,7 @@

     # check against acceptance list
     if (@$accept) {
-        unless (grep { $filename =~ /$_/ } @$accept) {
+        unless (grep { $file =~ /$_/ } @$accept) {
             printf "  - %-32s (not accepted)\n", $file
                 if $verbose;
             return;

With this fix, you can use the --accept option to do what you want,
as shown in the example above.

I've committed the fix to SVN.  There'll be a new release just as soon
as I finish the documentation updates I'm working on.

Cheers
A


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to