Add --exclude flag

This commit is contained in:
Jamie Cameron
2017-05-15 18:21:59 -07:00
parent f7da281d72
commit 26d05f0437

View File

@ -5,9 +5,11 @@
@ARGV >= 2 || die "usage: create-module.pl [--dir name] <file.wbm> <module>[/version] ..";
my $pwd;
chop($pwd = `pwd`);
# Parse command-line options
my @exclude;
while(@ARGV) {
if ($ARGV[0] eq "--dir") {
shift(@ARGV);
@ -17,17 +19,21 @@ while(@ARGV) {
shift(@ARGV);
$createsig = 1;
}
elsif ($ARGV[0] eq "--exclude") {
shift(@ARGV);
push(@exclude, shift(@ARGV));
}
else {
last;
}
}
$file = shift(@ARGV);
my $file = shift(@ARGV);
if ($file !~ /^\//) {
$file = "$pwd/$file";
}
unlink($file);
foreach $m (@ARGV) {
foreach my $m (@ARGV) {
# Parse module and forced version
$m =~ s/\/$//;
if ($m =~ /^(.*)\/(.*)$/) {
@ -46,6 +52,9 @@ foreach $m (@ARGV) {
$copydir = "/tmp/create-module/$subdir";
system("rm -rf $copydir");
system("cp -r -L $mod $copydir 2>/dev/null || cp -R -L $mod $copydir");
foreach my $e (@exclude) {
system("find $copydir -name ".quotemeta($e)." | xargs rm -rf");
}
# Find type from .info file
undef(%minfo);