Added tt-vars to pass variables to templates.
[dbsrgits/SQL-Translator.git] / bin / sqlt
index 7f46ca0..8e6ae19 100755 (executable)
--- a/bin/sqlt
+++ b/bin/sqlt
@@ -2,7 +2,7 @@
 # vim: set ft=perl:
 
 # -------------------------------------------------------------------
-# $Id: sqlt,v 1.15 2004-08-12 16:18:00 kycl4rk Exp $
+# $Id: sqlt,v 1.16 2004-11-25 23:15:23 grommit Exp $
 # -------------------------------------------------------------------
 # Copyright (C) 2002-4 SQLFairy Authors
 #
@@ -90,6 +90,7 @@ To translate a schema:
   TTSchema Producer Options:
 
     --template         The path to the template
+    --tt-var var=value Pass extra variables to the template
 
   XML-SQLFairy Producer Options:
 
@@ -123,7 +124,7 @@ use Pod::Usage;
 use SQL::Translator;
 
 use vars qw( $VERSION );
-$VERSION = sprintf "%d.%02d", q$Revision: 1.15 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.16 $ =~ /(\d+)\.(\d+)/;
 
 my $from;             # the original database
 my $to;               # the destination database
@@ -144,6 +145,7 @@ my $imap_file;        # filename where to place image map coords
 my $imap_url;         # URL to use in making image map
 my $pretty;           # use CGI::Pretty instead of CGI (HTML producer)
 my $template;         # template to pass to TTSchema producer
+my %tt_vars;          # additional template vars to pass the TTSchema producer
 my $title;            # title for HTML/POD producer
 my $add_prefix;       # Use explicit namespace prefix (XML producer)
 my $prefix;           # Set explicit namespace prefix (XML producer)
@@ -177,6 +179,7 @@ GetOptions(
     'rs:s'             => \$record_separator,
     'show-warnings'    => \$show_warnings,
     'template:s'       => \$template,
+    'tt-var=s'         => \%tt_vars,
     'title:s'          => \$title,
     'trace'            => \$trace,
     'v|validate'       => \$validate,
@@ -234,6 +237,7 @@ my $translator           =  SQL::Translator->new(
         imap_url         => $imap_url,
         pretty           => $pretty,
         ttfile           => $template,
+        tt_vars          => \%tt_vars,
         title            => $title,
         dsn              => $dumper_dsn,
         db_user          => $dumper_db_user,