First, I'm compelled to thank Andy Wardley and the others who have spent so 
much time 
developing Template Toolkit.

When I run ttree, there are two levels of verbosity:

        report everything in distracting detail
        report only errors

What I'd like most of the time is a middle position -- report only newly created
directories and files, modified files, and errors.  As it is, I run with 
verbose set, and
then scroll back to see which messages have a "+" next to them to confirm what 
changed.
On one website that I maintain, there is a folder of jpg's which simply get 
copied, so 90%
of the status lines are '  - images/foo.jpg   (not modified)'.

Locally I've made an ugly patch to add a new flag, "minverbose".  Here is the 
patch for my
two minute quick and dirty fix:

diff -u ttree ttree.new
--- ttree.orig  2008-12-30 09:52:33.989273600 -0600
+++ ttree       2008-12-30 19:12:01.379000000 -0600
@@ -63,6 +63,7 @@
  my $config   = read_config($RCFILE);
  my $dryrun   = $config->nothing;
  my $verbose  = $config->verbose || $dryrun;
+my $minverbose = $config->minverbose;
  my $recurse  = $config->recurse;
  my $preserve = $config->preserve;
  my $all      = $config->all;
@@ -279,7 +280,7 @@
                      # chown($uid, $gid, $target) || warn "chown($target): 
$!\n";

                      printf "  + %-32s (created target directory)\n", $path
-                        if $verbose;
+                        if $verbose || $minverbose;
                  }
                  # recurse into directory
                  process_tree($path);
@@ -373,12 +374,12 @@
          }

          printf "  > %-32s (copied, matches /$check/)\n", $file
-            if $verbose;
+            if $verbose || $minverbose;

          return;
      }

-    if ($verbose) {
+    if ($verbose || $minverbose) {
          printf("  + %-32s", $file);
          print " (changed suffix to $new_suffix)" if $new_suffix;
          print "\n";
@@ -515,6 +516,7 @@
          'lib|l=s@'    => { EXPAND => EXPAND_ALL },
          'cfg|c=s'     => { EXPAND => EXPAND_ALL, DEFAULT => '.' },
          'verbose|v'   => { DEFAULT => 0 },
+        'minverbose|mv'  => { DEFAULT => 0 },
          'recurse|r'   => { DEFAULT => 0 },
          'nothing|n'   => { DEFAULT => 0 },
          'preserve|p'  => { DEFAULT => 0 },



Ideally patch will be ignored and someone more capable will come up with a 
better
solution.  For instance, it might be better to generalize the "verbose" flag.  
By default
"verbose" would default to max verbosity for compatibility, but if you followed 
it with a
decimal number, then it would set the verbosity level.

        verbose 0  # off; same as not specifying verbose at all
        verbose 1  # only the essentials, like my minverbose flag
         verbose 2  # more verbose, etc
        verbose    # maximum

Perhaps only 0/1/infinity are needed.

Thanks


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

Reply via email to