cvsreport-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cvsreport] added 'my' command [...]


From: Vincent Caron <address@hidden>
Subject: [cvsreport] added 'my' command [...]
Date: Wed, 30 Jul 2003 21:24:43 -0400

Commit from zerodeux 2003-07-31 07:24 UTC
added 'my' command

Let user defines its own variables.

Well, I think it's time for a release, and test that Debian packaging stuff.
If someone can have a try with the CVS version in the next days, that would
be cool.

TTimo: see http://savannah.nongnu.org/cgi-bin/viewcvs/cvsreport/cvsreport/example.conf?rev=1.3
which shows you can't complain any more ! :)

BTW, please also check the man page, I'm not sure if it's still consistent
with all these patches. And new features might be badly documented (heck, I
need to look the doc regularly myself, too many features :)).
Module File name Revision
cvsreport cvsreport 1.25 >>> 1.26
cvsreport cvsreport.1 1.12 >>> 1.13
cvsreport example.conf 1.2 >>> 1.3

cvsreport/cvsreport   1.25 >>> 1.26
Line 1555
  # Configuration parsing
  #
 
+ # Parse "key [= value ...]"
+ #
+ # Does $(var) substitution.
+ #
+ sub parse_assignation {
+     my @tokens = split /=/, shift, 2;
+     my $key = $tokens[0];
+     my $val = @tokens > 1 ? $tokens[1] : '';
+     $key =~ s/[ \t]*$//;  # Remove trailing blanks
+     $val =~ s/^[ \t]*//;  # Remove heading blanks
+     $val = subst_vars $val;
+
+     return ($key, $val);
+ }
+
+
  sub parse_set_decl {
      my $conf = shift;
 
Line 1596
          return;
      }
 
-     my @tokens = split /=/, $line, 2;
-     my $key = $tokens[0];
-     my $val = @tokens > 1 ? $tokens[1] : '';
-     $key =~ s/[ \t]*$//;  # Remove trailing blanks
-     $val =~ s/^[ \t]*//;  # Remove heading blanks
-     $val = subst_vars $val;
+     my ($key, $val) = parse_assignation $line;
      $conf->{set_current}{$key} = $val;
  }
 
+ sub parse_my {
+     my $conf = shift;
+     my $line = shift;
+     $line =~ s/my[ \t]*//;  # Remove the first 'my' token.
+
+     my ($key, $val) = parse_assignation $line;
+     $vars{$key} = $val;
+ }
+
  sub parse_command {
      my $conf = shift;
 
Line 1651
          if    ($state eq 'set_begin') { parse_set_begin $conf, @tokens }
          elsif ($state eq 'set_stmt')  { parse_set_stmt  $conf, $line   }
          elsif ($tokens[0] eq 'set')   { parse_set_decl  $conf, @tokens }
+         elsif ($tokens[0] eq 'my')    { parse_my        $conf, $line }
          else                          { parse_command   $conf, $line }
      }
  }

cvsreport/cvsreport.1   1.12 >>> 1.13
Line 135
  via the \fImail\fP configuration set.
 
  .TP
+ .B my \fIvariable\fP = \fIvalue\fP ...
+
+ Define a user variable, which can be then referred with  \fB$(name)\fP later. See
+ \fBCONFIGURATION\fP for a list of default variables.
+
+ .TP
  .B run \fIcommand\fP [\fIargs\fP] ...
 
  Run a user command with its argument. It is only called if there is at least one

cvsreport/example.conf   1.2 >>> 1.3
Line 1
+ my to_diff = [Mm]akefile
+
  set text {
-   diff = [Mm]akefile
+   diff = $(to_diff)
+   diff_format = context
  }
 
  set html {
-   diff = [Mm]akefile
+   diff = $(to_diff)
    cgi_links   = yes
    cgi_urlbase = http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mesa3d
  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]