add shelltype option
[p5sagit/local-lib.git] / lib / local / lib.pm
index 8718f78..1e4808e 100644 (file)
@@ -15,6 +15,7 @@ sub import {
   my ($class, @args) = @_;
 
   my @steps;
+  my %opts;
 
   while (@args) {
     my $arg = shift @args;
@@ -33,13 +34,17 @@ DEATH
     elsif ($arg eq '--self-contained') {
       die "FATAL: The local::lib --self-contained flag has never worked reliably and the original author, Mark Stosberg, was unable or unwilling to maintain it. As such, this flag has been removed from the local::lib codebase in order to prevent misunderstandings and potentially broken builds. The local::lib authors recommend that you look at the lib::core::only module shipped with this distribution in order to create a more robust environment that is equivalent to what --self-contained provided (although quite possibly not what you originally thought it provided due to the poor quality of the documentation, for which we apologise).\n";
     }
-    elsif( $arg eq '--deactivate' ) {
-      my $path = shift @args;
+    elsif( $arg =~ /^--deactivate(?:=(.*))?$/ ) {
+      my $path = defined $1 ? $1 : shift @args;
       push @steps, ['deactivate', $path];
     }
     elsif ( $arg eq '--deactivate-all' ) {
       push @steps, ['deactivate_all'];
     }
+    elsif ( $arg =~ /^--shelltype(?:=(.*))?$/ ) {
+      my $shell = defined $1 ? $1 : shift @args;
+      $opts{shelltype} = $shell;
+    }
     elsif ( $arg =~ /^--/ ) {
       die "Unknown import argument: $arg";
     }
@@ -51,7 +56,7 @@ DEATH
     push @steps, ['activate', undef];
   }
 
-  my $self = $class->new;
+  my $self = $class->new(%opts);
 
   for (@steps) {
     my ($method, @args) = @$_;