diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/guards.in | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/bin/guards.in b/bin/guards.in index 7a18c41..246855a 100644 --- a/bin/guards.in +++ b/bin/guards.in @@ -41,7 +41,18 @@ sub files_in($$) { my $dh = new FileHandle; my (@files, $file); + # @<file> syntax + if ($path =~ s/^@//) { + my $fh; + open($fh, '<', $path) or die "$path: $!\n"; + @files = <$fh>; + close($fh); + chomp(@files); + s:^$dir:: for @files; + return @files; + } + $path = slashme($path); opendir $dh, length("$dir$path") ? "$dir$path" : '.' or die "$dir$path: $!\n"; while ($file = readdir($dh)) { @@ -100,7 +111,8 @@ sub help() { print "SYNOPSIS: $0 [--prefix=dir] [--path=dir1:dir2:...]\n" . " [--default=0|1] [--check|--list] [--invert-match]\n" . " [--with-guards] [--config=file] symbol ...\n\n" . - " Defaults: --default=$default\n"; + " Defaults: --default=$default\n" . + " Use --path=\@<file> to read the list of entries from <file>\n"; exit 0; } @@ -145,7 +157,7 @@ if ($check) { my @files; foreach (@path) { - @files = (@files, files_in($dir, slashme($_))); + @files = (@files, files_in($dir, $_)); } my %files = map { $_ => 0 } @files; |