update MANIFEST without needing to chdir
[p5sagit/Distar.git] / helpers / add-to-manifest
index 93608aa..2e837bd 100755 (executable)
@@ -3,6 +3,18 @@ use strict;
 use warnings FATAL => 'all';
 
 use ExtUtils::Manifest 'maniadd';
+use Getopt::Long qw(:config gnu_getopt);
+
+GetOptions(
+  "d|distdir=s"    => \my $distdir,
+  "m|manifest=s"   => \my $manifest,
+) or die("Error in command line arguments\n");
+if (defined $distdir) {
+  chdir $distdir;
+}
+if (defined $manifest) {
+  $ExtUtils::Manifest::MANIFEST = $manifest;
+}
 
 for my $file (@ARGV) {
   eval { maniadd({ $file => "$file file (added by Distar)"}) }