add useful tool
This commit is contained in:
parent
a5827993c5
commit
46850a2430
8 changed files with 5817 additions and 3 deletions
44
tools/docgen.pl
Executable file
44
tools/docgen.pl
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use FindBin;
|
||||
use File::Path;
|
||||
|
||||
if(@ARGV < 3){
|
||||
print("Usage ./tools/docgen.pl lsp outdir indir ...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sub scan {
|
||||
my @args = @_;
|
||||
my $path = $args[0];
|
||||
my $top = $args[1];
|
||||
|
||||
opendir(my $dh, $path);
|
||||
|
||||
my @files = readdir($dh);
|
||||
foreach my $file (@files){
|
||||
if(($file eq ".") || ($file eq "..")){
|
||||
next;
|
||||
}
|
||||
|
||||
if(-d "$path/$file"){
|
||||
scan("$path/$file", $top);
|
||||
}else{
|
||||
print("$path/$file\n");
|
||||
|
||||
my $dir = "$ARGV[1]/$file";
|
||||
|
||||
$dir =~ s/\..*$//;
|
||||
|
||||
mkpath($dir);
|
||||
|
||||
system("$FindBin::Bin/lsp.pl \"$ARGV[0]\" \"$path/$file\" \"$dir/index.xml\" \"$top\"\n");
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dh);
|
||||
}
|
||||
|
||||
for(my $i = 2; $i < @ARGV; $i += 1){
|
||||
scan($ARGV[$i], $ARGV[$i]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue