File: stag-show-template.pl

package info (click to toggle)
libdbix-dbstag-perl 0.12-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 1,424 kB
  • ctags: 826
  • sloc: perl: 6,152; sql: 588; xml: 221; lisp: 59; makefile: 20
file content (51 lines) | stat: -rwxr-xr-x 789 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/local/bin/perl

# stag-q
# cjm@fruitfly.org

use strict;
use Carp;
use DBIx::DBStag;
use Data::Stag qw(:all);
use Data::Dumper;
use Getopt::Long;
use Term::ANSIColor;

my $h = {};

my $dbname = '';
my $connect;
my $term;
my @hist = ();

my %cscheme =
  (
   'keyword'=>'cyan',
   'variable'=>'magenta',
   'text' => 'reset',
   'comment' => 'red',
   'block' => 'blue',
   'property' => 'green',
  );

GetOptions(
           "dbname|d=s"=>\$dbname,
           "connect|c"=>\$connect,
          );

my $match = shift;
# parent dbh
my $sdbh = 
  DBIx::DBStag->new;

my $all_templates =
  $sdbh->template_list;

my @templates = @$all_templates;
if ($match) {
    @templates = grep {$_->name =~ /$match/} @templates;
}
foreach my $t (@templates) {
    $t->show(\*STDOUT, \%cscheme);
}