Lines 24-29
use VerboseWarnings qw( :warn :die );
Link Here
|
24 |
|
24 |
|
25 |
use vars qw( @in_dirs @filenames $str_file $out_dir $quiet ); |
25 |
use vars qw( @in_dirs @filenames $str_file $out_dir $quiet ); |
26 |
use vars qw( @excludes $exclude_regex ); |
26 |
use vars qw( @excludes $exclude_regex ); |
|
|
27 |
use vars qw( $match $nomatch ); |
27 |
use vars qw( $recursive_p ); |
28 |
use vars qw( $recursive_p ); |
28 |
use vars qw( $pedantic_p ); |
29 |
use vars qw( $pedantic_p ); |
29 |
use vars qw( $href ); |
30 |
use vars qw( $href ); |
Lines 144-152
sub listfiles {
Link Here
|
144 |
|| (defined $exclude_regex && $dirent =~ /^(?:$exclude_regex)$/)) { |
145 |
|| (defined $exclude_regex && $dirent =~ /^(?:$exclude_regex)$/)) { |
145 |
; |
146 |
; |
146 |
} elsif (-f $path) { |
147 |
} elsif (-f $path) { |
147 |
my $basename = basename $path; |
148 |
my $basename = fileparse( $path ); |
148 |
push @it, $path |
149 |
push @it, $path |
149 |
if ( not @$filenames or ( grep { $path =~ /$_/ } @$filenames ) ) |
150 |
if ( not @$filenames or ( grep { $path =~ /$_/ } @$filenames ) ) |
|
|
151 |
and ( not defined $match or $basename =~ /($match)/i ) # files to include |
152 |
and ( not defined $nomatch or $basename !~ /($nomatch)/i ) # files not to include |
150 |
and (!defined $type || $dirent =~ /\.(?:$type)$/) || $action eq 'install'; |
153 |
and (!defined $type || $dirent =~ /\.(?:$type)$/) || $action eq 'install'; |
151 |
} elsif (-d $path && $recursive_p) { |
154 |
} elsif (-d $path && $recursive_p) { |
152 |
push @it, listfiles($path, $type, $action, $filenames); |
155 |
push @it, listfiles($path, $type, $action, $filenames); |
Lines 167-173
sub mkdir_recursive ($) {
Link Here
|
167 |
my ($prefix, $basename) = ($dir =~ /\/([^\/]+)$/s)? ($`, $1): ('.', $dir); |
170 |
my ($prefix, $basename) = ($dir =~ /\/([^\/]+)$/s)? ($`, $1): ('.', $dir); |
168 |
mkdir_recursive($prefix) if $prefix ne '.' && !-d $prefix; |
171 |
mkdir_recursive($prefix) if $prefix ne '.' && !-d $prefix; |
169 |
if (!-d $dir) { |
172 |
if (!-d $dir) { |
170 |
print STDERR "Making directory $dir..." unless $quiet; |
173 |
print STDERR "Making directory $dir...\n" unless $quiet; |
171 |
# creates with rwxrwxr-x permissions |
174 |
# creates with rwxrwxr-x permissions |
172 |
mkdir($dir, 0775) || warn_normal "$dir: $!", undef; |
175 |
mkdir($dir, 0775) || warn_normal "$dir: $!", undef; |
173 |
} |
176 |
} |
Lines 196-202
Create or update PO files from templates, or install translated templates.
Link Here
|
196 |
If given, only these files will be processed. |
199 |
If given, only these files will be processed. |
197 |
-s, --str-file=FILE Specify FILE as the translation (po) file |
200 |
-s, --str-file=FILE Specify FILE as the translation (po) file |
198 |
for input (install) or output (create, update) |
201 |
for input (install) or output (create, update) |
199 |
-x, --exclude=REGEXP Exclude files matching the given REGEXP |
202 |
-x, --exclude=REGEXP Exclude dirs matching the given REGEXP |
|
|
203 |
-m, --match=STRING Pipe (|) separated list. Include only files |
204 |
with names matching the given REGEXP |
205 |
-n, --nomatch=STRING Pipe (|) separated list. Exclude all files |
206 |
with names matching the given STRING |
200 |
--help Display this help and exit |
207 |
--help Display this help and exit |
201 |
-q, --quiet no output to screen (except for errors) |
208 |
-q, --quiet no output to screen (except for errors) |
202 |
|
209 |
|
Lines 225-230
GetOptions(
Link Here
|
225 |
'recursive|r' => \$recursive_p, |
232 |
'recursive|r' => \$recursive_p, |
226 |
'str-file|s=s' => \$str_file, |
233 |
'str-file|s=s' => \$str_file, |
227 |
'exclude|x=s' => \@excludes, |
234 |
'exclude|x=s' => \@excludes, |
|
|
235 |
'match|m=s' => \$match, |
236 |
'nomatch|n=s' => \$nomatch, |
228 |
'quiet|q' => \$quiet, |
237 |
'quiet|q' => \$quiet, |
229 |
'pedantic-warnings|pedantic' => sub { $pedantic_p = 1 }, |
238 |
'pedantic-warnings|pedantic' => sub { $pedantic_p = 1 }, |
230 |
'help' => \&usage, |
239 |
'help' => \&usage, |
231 |
- |
|
|